From: kernel test robot <lkp@intel.com>
To: Thara Gopinath <thara.gopinath@linaro.org>
Cc: clang-built-linux@googlegroups.com, kbuild-all@lists.01.org,
Linux Memory Management List <linux-mm@kvack.org>,
Viresh Kumar <viresh.kumar@linaro.org>
Subject: [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: Sun, 22 Aug 2021 19:41:38 +0800 [thread overview]
Message-ID: <202108221933.WIgFqDfv-lkp@intel.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 15346 bytes --]
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>
clang-analyzer warnings: (new ones prefixed by >>)
^ ~
drivers/hid/hid-core.c:1412:22: warning: The result of the left shift is undefined due to shifting by '32', which is greater or equal to the width of type 'unsigned int' [clang-analyzer-core.UndefinedBinaryOperatorResult]
u8 bit_mask = ((1U << n) - 1);
^
drivers/hid/hid-core.c:1717:6: note: Assuming 'buf' is non-null
if (!buf)
^~~~
drivers/hid/hid-core.c:1717:2: note: Taking false branch
if (!buf)
^
drivers/hid/hid-core.c:1722:6: note: Assuming 'reqtype' is equal to HID_REQ_SET_REPORT
if (reqtype == HID_REQ_SET_REPORT)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/hid/hid-core.c:1722:2: note: Taking true branch
if (reqtype == HID_REQ_SET_REPORT)
^
drivers/hid/hid-core.c:1723:3: note: Calling 'hid_output_report'
hid_output_report(report, buf);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/hid/hid-core.c:1630:14: note: Field 'id' is <= 0
if (report->id > 0)
^
drivers/hid/hid-core.c:1630:2: note: Taking false branch
if (report->id > 0)
^
drivers/hid/hid-core.c:1634:14: note: Assuming 'n' is < field 'maxfield'
for (n = 0; n < report->maxfield; n++)
^~~~~~~~~~~~~~~~~~~~
drivers/hid/hid-core.c:1634:2: note: Loop condition is true. Entering loop body
for (n = 0; n < report->maxfield; n++)
^
drivers/hid/hid-core.c:1635:3: note: Calling 'hid_output_field'
hid_output_field(report->device, report->field[n], data);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/hid/hid-core.c:1597:2: note: 'size' initialized here
unsigned size = field->report_size;
^~~~~~~~~~~~~
drivers/hid/hid-core.c:1600:14: note: Assuming 'n' is < 'count'
for (n = 0; n < count; n++) {
^~~~~~~~~
drivers/hid/hid-core.c:1600:2: note: Loop condition is true. Entering loop body
for (n = 0; n < count; n++) {
^
drivers/hid/hid-core.c:1601:7: note: Assuming field 'logical_minimum' is >= 0
if (field->logical_minimum < 0) /* signed values */
^~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/hid/hid-core.c:1601:3: note: Taking false branch
if (field->logical_minimum < 0) /* signed values */
^
drivers/hid/hid-core.c:1605:44: note: Passing value via 4th parameter 'n'
implement(hid, data, offset + n * size, size,
^~~~
drivers/hid/hid-core.c:1605:4: note: Calling 'implement'
implement(hid, data, offset + n * size, size,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/hid/hid-core.c:1421:15: note: Assuming 'n' is <= 32
if (unlikely(n > 32)) {
^
include/linux/compiler.h:78:42: note: expanded from macro 'unlikely'
# define unlikely(x) __builtin_expect(!!(x), 0)
^
drivers/hid/hid-core.c:1421:2: note: Taking false branch
if (unlikely(n > 32)) {
^
drivers/hid/hid-core.c:1425:13: note: Assuming 'n' is >= 32
} else if (n < 32) {
^~~~~~
drivers/hid/hid-core.c:1425:9: note: Taking false branch
} else if (n < 32) {
^
drivers/hid/hid-core.c:1437:30: note: Passing the value 32 via 3rd parameter 'n'
__implement(report, offset, n, value);
^
drivers/hid/hid-core.c:1437:2: note: Calling '__implement'
__implement(report, offset, n, value);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/hid/hid-core.c:1400:9: note: Assuming the condition is false
while (n - bits_to_set >= 0) {
^~~~~~~~~~~~~~~~~~~~
drivers/hid/hid-core.c:1400:2: note: Loop condition is false. Execution continues on line 1411
while (n - bits_to_set >= 0) {
^
drivers/hid/hid-core.c:1411:6: note: 'n' is 32
if (n) {
^
drivers/hid/hid-core.c:1411:2: note: Taking true branch
if (n) {
^
drivers/hid/hid-core.c:1412:22: note: The result of the left shift is undefined due to shifting by '32', which is greater or equal to the width of type 'unsigned int'
u8 bit_mask = ((1U << n) - 1);
^ ~
drivers/hid/hid-core.c:1984:3: warning: Value stored to 'len' is never read [clang-analyzer-deadcode.DeadStores]
len += sprintf(buf + len, "%shidraw%d", len ? "," : "",
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/hid/hid-core.c:1984:3: note: Value stored to 'len' is never read
len += sprintf(buf + len, "%shidraw%d", len ? "," : "",
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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.
3 warnings generated.
>> 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
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 37313 bytes --]
next reply other threads:[~2021-08-22 11:42 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-22 11:41 kernel test robot [this message]
2021-08-23 6:52 ` Viresh Kumar
2021-08-24 6:53 ` Chen, Rong A
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=202108221933.WIgFqDfv-lkp@intel.com \
--to=lkp@intel.com \
--cc=clang-built-linux@googlegroups.com \
--cc=kbuild-all@lists.01.org \
--cc=linux-mm@kvack.org \
--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