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 Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





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

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







[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux