From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.6 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING, NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 256B1C4338F for ; Tue, 24 Aug 2021 06:53:38 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 9375461356 for ; Tue, 24 Aug 2021 06:53:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 9375461356 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id A0F808D0001; Tue, 24 Aug 2021 02:53:36 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 998E26B0071; Tue, 24 Aug 2021 02:53:36 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 838FB8D0001; Tue, 24 Aug 2021 02:53:36 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0056.hostedemail.com [216.40.44.56]) by kanga.kvack.org (Postfix) with ESMTP id 629AE6B006C for ; Tue, 24 Aug 2021 02:53:36 -0400 (EDT) Received: from smtpin31.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id EC3211801F2D2 for ; Tue, 24 Aug 2021 06:53:35 +0000 (UTC) X-FDA: 78509058390.31.371B104 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by imf27.hostedemail.com (Postfix) with ESMTP id 0BAB570000A6 for ; Tue, 24 Aug 2021 06:53:34 +0000 (UTC) X-IronPort-AV: E=McAfee;i="6200,9189,10085"; a="217252354" X-IronPort-AV: E=Sophos;i="5.84,346,1620716400"; d="scan'208";a="217252354" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Aug 2021 23:53:32 -0700 X-IronPort-AV: E=Sophos;i="5.84,346,1620716400"; d="scan'208";a="526500559" Received: from rongch2-mobl.ccr.corp.intel.com (HELO [10.249.172.62]) ([10.249.172.62]) by fmsmga003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Aug 2021 23:53:30 -0700 Subject: Re: [linux-next:master 8440/9522] drivers/cpufreq/qcom-cpufreq-hw.c:294:3: warning: Value stored to 'opp' is never read [clang-analyzer-deadcode.DeadStores] To: Viresh Kumar , kernel test robot Cc: Thara Gopinath , clang-built-linux@googlegroups.com, kbuild-all@lists.01.org, Linux Memory Management List References: <202108221933.WIgFqDfv-lkp@intel.com> <20210823065211.mzagmzexavwxu4vy@vireshk-i7> From: "Chen, Rong A" Message-ID: <38f16bcf-40bc-c400-ef64-da8e43b1135f@intel.com> Date: Tue, 24 Aug 2021 14:53:28 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Firefox/78.0 Thunderbird/78.12.0 MIME-Version: 1.0 In-Reply-To: <20210823065211.mzagmzexavwxu4vy@vireshk-i7> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Authentication-Results: imf27.hostedemail.com; dkim=none; dmarc=fail reason="No valid SPF, No valid DKIM" header.from=intel.com (policy=none); spf=none (imf27.hostedemail.com: domain of rong.a.chen@intel.com has no SPF policy when checking 134.134.136.24) smtp.mailfrom=rong.a.chen@intel.com X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 0BAB570000A6 X-Stat-Signature: 9cs7xnc38iagihqztfw8o3d4wusbtob5 X-HE-Tag: 1629788014-773027 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 8/23/2021 2:52 PM, Viresh Kumar wrote: > On 22-08-21, 19:41, kernel test robot wrote: >> tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master >> head: 86ed57fd8c93fdfaabb4f58e78455180fa7d8a84 >> commit: 86afc1df661a99dcd6b8d264cae171f1ead2b7b8 [8440/9522] cpufreq: qcom-cpufreq-hw: Add dcvs interrupt support >> config: arm-randconfig-c002-20210822 (attached as .config) >> compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project a83d99c55ebb14532c414066a5aa3bdb65389965) >> reproduce (this is a W=1 build): >> wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross >> chmod +x ~/bin/make.cross >> # install arm cross compiling tool for clang build >> # apt-get install binutils-arm-linux-gnueabi >> # https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=86afc1df661a99dcd6b8d264cae171f1ead2b7b8 >> git remote add linux-next https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git >> git fetch --no-tags linux-next master >> git checkout 86afc1df661a99dcd6b8d264cae171f1ead2b7b8 >> # save the attached .config to linux build tree >> COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm clang-analyzer >> >> If you fix the issue, kindly add following tag as appropriate >> Reported-by: kernel test robot > > This doesn't look right, it says issues are with cpufreq-hw driver but > points at hid-core ? Hi Viresh, The warning with the prefix ">>" is pointed to this commit, others are only for reference. Best Regards, Rong Chen > >> clang-analyzer warnings: (new ones prefixed by >>) >>>> drivers/cpufreq/qcom-cpufreq-hw.c:294:3: warning: Value stored to 'opp' is never read [clang-analyzer-deadcode.DeadStores] >> opp = dev_pm_opp_find_freq_ceil(dev, &freq_hz); >> ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >> drivers/cpufreq/qcom-cpufreq-hw.c:294:3: note: Value stored to 'opp' is never read >> opp = dev_pm_opp_find_freq_ceil(dev, &freq_hz); >> ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >> Suppressed 2 warnings (2 in non-user code). >> Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. >> 2 warnings generated. >> Suppressed 2 warnings (2 in non-user code). >> Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. >> 2 warnings generated. >> Suppressed 2 warnings (2 in non-user code). >> Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. >> 2 warnings generated. >> Suppressed 2 warnings (2 in non-user code). >> Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. >> 7 warnings generated. >> Suppressed 7 warnings (7 in non-user code). >> Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. >> 3 warnings generated. >> Suppressed 3 warnings (3 in non-user code). >> Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. >> 2 warnings generated. >> Suppressed 2 warnings (2 in non-user code). >> Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. >> 2 warnings generated. >> Suppressed 2 warnings (2 in non-user code). >> Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. >> 3 warnings generated. >> Suppressed 3 warnings (3 in non-user code). >> Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. >> 3 warnings generated. >> Suppressed 3 warnings (3 in non-user code). >> Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. >> 3 warnings generated. >> Suppressed 3 warnings (3 in non-user code). >> Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. >> 6 warnings generated. >> Suppressed 6 warnings (6 in non-user code). >> Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. >> 2 warnings generated. >> Suppressed 2 warnings (2 in non-user code). >> Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. >> 2 warnings generated. >> Suppressed 2 warnings (2 in non-user code). >> Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. >> 7 warnings generated. >> drivers/dma/xgene-dma.c:445:36: warning: The result of the left shift is undefined due to shifting by '32', which is greater or equal to the width of type 'int' [clang-analyzer-core.UndefinedBinaryOperatorResult] >> desc1->m2 |= cpu_to_le64((scf[i] << ((i + 1) * 8))); >> ^ >> include/linux/byteorder/generic.h:86:21: note: expanded from macro 'cpu_to_le64' >> #define cpu_to_le64 __cpu_to_le64 >> ^ >> drivers/dma/xgene-dma.c:895:15: note: Assuming 'dchan' is non-null >> if (unlikely(!dchan || !len)) >> ^ >> include/linux/compiler.h:78:42: note: expanded from macro 'unlikely' >> # define unlikely(x) __builtin_expect(!!(x), 0) >> ^ >> drivers/dma/xgene-dma.c:895:15: note: Left side of '||' is false >> if (unlikely(!dchan || !len)) >> ^ >> drivers/dma/xgene-dma.c:895:25: note: Assuming 'len' is not equal to 0 >> if (unlikely(!dchan || !len)) >> ^ >> include/linux/compiler.h:78:42: note: expanded from macro 'unlikely' >> # define unlikely(x) __builtin_expect(!!(x), 0) >> ^ >> drivers/dma/xgene-dma.c:895:2: note: Taking false branch >> if (unlikely(!dchan || !len)) >> ^ >> drivers/dma/xgene-dma.c:898:9: note: Left side of '&&' is false >> chan = to_dma_chan(dchan); >> ^ >> drivers/dma/xgene-dma.c:191:2: note: expanded from macro 'to_dma_chan' >> container_of(dchan, struct xgene_dma_chan, dma_chan) >> ^ >> include/linux/kernel.h:495:61: note: expanded from macro 'container_of' >> BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ >> ^ >> drivers/dma/xgene-dma.c:898:9: note: Taking false branch >> chan = to_dma_chan(dchan); >> ^ >> drivers/dma/xgene-dma.c:191:2: note: expanded from macro 'to_dma_chan' >> container_of(dchan, struct xgene_dma_chan, dma_chan) >> ^ >> include/linux/kernel.h:495:2: note: expanded from macro 'container_of' >> BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ >> ^ >> include/linux/build_bug.h:39:37: note: expanded from macro 'BUILD_BUG_ON_MSG' >> #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) >> ^ >> include/linux/compiler_types.h:328:2: note: expanded from macro 'compiletime_assert' >> _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) >> ^ >> include/linux/compiler_types.h:316:2: note: expanded from macro '_compiletime_assert' >> __compiletime_assert(condition, msg, prefix, suffix) >> ^ >> include/linux/compiler_types.h:308:3: note: expanded from macro '__compiletime_assert' >> if (!(condition)) \ >> >> vim +/opp +294 drivers/cpufreq/qcom-cpufreq-hw.c >> >> 275 >> 276 static void qcom_lmh_dcvs_notify(struct qcom_cpufreq_data *data) >> 277 { >> 278 unsigned long max_capacity, capacity, freq_hz, throttled_freq; >> 279 struct cpufreq_policy *policy = data->policy; >> 280 int cpu = cpumask_first(policy->cpus); >> 281 struct device *dev = get_cpu_device(cpu); >> 282 struct dev_pm_opp *opp; >> 283 unsigned int freq; >> 284 >> 285 /* >> 286 * Get the h/w throttled frequency, normalize it using the >> 287 * registered opp table and use it to calculate thermal pressure. >> 288 */ >> 289 freq = qcom_lmh_get_throttle_freq(data); >> 290 freq_hz = freq * HZ_PER_KHZ; >> 291 >> 292 opp = dev_pm_opp_find_freq_floor(dev, &freq_hz); >> 293 if (IS_ERR(opp) && PTR_ERR(opp) == -ERANGE) >> > 294 opp = dev_pm_opp_find_freq_ceil(dev, &freq_hz); >> 295 >> 296 throttled_freq = freq_hz / HZ_PER_KHZ; >> 297 >> 298 /* Update thermal pressure */ >> 299 >> 300 max_capacity = arch_scale_cpu_capacity(cpu); >> 301 capacity = mult_frac(max_capacity, throttled_freq, policy->cpuinfo.max_freq); >> 302 >> 303 /* Don't pass boost capacity to scheduler */ >> 304 if (capacity > max_capacity) >> 305 capacity = max_capacity; >> 306 >> 307 arch_set_thermal_pressure(policy->cpus, max_capacity - capacity); >> 308 >> 309 /* >> 310 * In the unlikely case policy is unregistered do not enable >> 311 * polling or h/w interrupt >> 312 */ >> 313 mutex_lock(&data->throttle_lock); >> 314 if (data->cancel_throttle) >> 315 goto out; >> 316 >> 317 /* >> 318 * If h/w throttled frequency is higher than what cpufreq has requested >> 319 * for, then stop polling and switch back to interrupt mechanism. >> 320 */ >> 321 if (throttled_freq >= qcom_cpufreq_hw_get(cpu)) >> 322 enable_irq(data->throttle_irq); >> 323 else >> 324 mod_delayed_work(system_highpri_wq, &data->throttle_work, >> 325 msecs_to_jiffies(10)); >> 326 >> 327 out: >> 328 mutex_unlock(&data->throttle_lock); >> 329 } >> 330 >> >> --- >> 0-DAY CI Kernel Test Service, Intel Corporation >> https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org > > >