linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "Chen, Rong A" <rong.a.chen@intel.com>
To: Viresh Kumar <viresh.kumar@linaro.org>,
	kernel test robot <lkp@intel.com>
Cc: Thara Gopinath <thara.gopinath@linaro.org>,
	clang-built-linux@googlegroups.com, kbuild-all@lists.01.org,
	Linux Memory Management List <linux-mm@kvack.org>
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]
Date: Tue, 24 Aug 2021 14:53:28 +0800	[thread overview]
Message-ID: <38f16bcf-40bc-c400-ef64-da8e43b1135f@intel.com> (raw)
In-Reply-To: <20210823065211.mzagmzexavwxu4vy@vireshk-i7>



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 <lkp@intel.com>
> 
> 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 >>)

<snip>

>>>> 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
> 
> 
> 


  reply	other threads:[~2021-08-24  6:53 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-22 11:41 kernel test robot
2021-08-23  6:52 ` Viresh Kumar
2021-08-24  6:53   ` Chen, Rong A [this message]
2021-08-24  7:11     ` Viresh Kumar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=38f16bcf-40bc-c400-ef64-da8e43b1135f@intel.com \
    --to=rong.a.chen@intel.com \
    --cc=clang-built-linux@googlegroups.com \
    --cc=kbuild-all@lists.01.org \
    --cc=linux-mm@kvack.org \
    --cc=lkp@intel.com \
    --cc=thara.gopinath@linaro.org \
    --cc=viresh.kumar@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox