All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: kbuild@lists.01.org
Subject: drivers/thermal/qcom/qcom-spmi-adc-tm5.c:332:2: warning: Value stored to 'chip' is never read [clang-analyzer-deadcode.DeadStores]
Date: Mon, 22 Nov 2021 01:19:11 +0800	[thread overview]
Message-ID: <202111220108.io1PyJ0c-lkp@intel.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 14836 bytes --]

CC: llvm(a)lists.linux.dev
CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
CC: Daniel Lezcano <daniel.lezcano@linaro.org>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   923dcc5eb0c111eccd51cc7ce1658537e3c38b25
commit: ca66dca5eda6bd16b7b27fed2a034f2396df5627 thermal: qcom: add support for adc-tm5 PMIC thermal monitor
date:   9 months ago
:::::: branch date: 20 hours ago
:::::: commit date: 9 months ago
config: arm-randconfig-c002-20211119 (attached as .config)
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/torvalds/linux.git/commit/?id=ca66dca5eda6bd16b7b27fed2a034f2396df5627
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout ca66dca5eda6bd16b7b27fed2a034f2396df5627
        # 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-logitech-hidpp.c:3204:2: note: Taking false branch
           if (hidpp->quirks & HIDPP_QUIRK_CLASS_WTP)
           ^
   drivers/hid/hid-logitech-hidpp.c:3206:11: note: Assuming the condition is false
           else if (hidpp->quirks & HIDPP_QUIRK_CLASS_M560 &&
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/hid/hid-logitech-hidpp.c:3206:50: note: Left side of '&&' is false
           else if (hidpp->quirks & HIDPP_QUIRK_CLASS_M560 &&
                                                           ^
   drivers/hid/hid-logitech-hidpp.c:3210:6: note: Assuming field 'product' is equal to DINOVO_MINI_PRODUCT_ID
           if (hdev->product == DINOVO_MINI_PRODUCT_ID)
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/hid/hid-logitech-hidpp.c:3210:2: note: Taking true branch
           if (hdev->product == DINOVO_MINI_PRODUCT_ID)
           ^
   drivers/hid/hid-logitech-hidpp.c:3211:10: note: Calling 'lg_dinovo_input_mapping'
                   return lg_dinovo_input_mapping(hdev, hi, field, usage, bit, max);
                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/hid/hid-logitech-hidpp.c:2964:6: note: Assuming the condition is false
           if ((usage->hid & HID_USAGE_PAGE) != HID_UP_LOGIVENDOR)
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/hid/hid-logitech-hidpp.c:2964:2: note: Taking false branch
           if ((usage->hid & HID_USAGE_PAGE) != HID_UP_LOGIVENDOR)
           ^
   drivers/hid/hid-logitech-hidpp.c:2967:2: note: Control jumps to 'case 13:'  at line 2968
           switch (usage->hid & HID_USAGE) {
           ^
   drivers/hid/hid-logitech-hidpp.c:2968:14: note: Calling 'hid_map_usage_clear'
           case 0x00d: lg_map_key_clear(KEY_MEDIA);        break;
                       ^
   drivers/hid/hid-logitech-hidpp.c:96:30: note: expanded from macro 'lg_map_key_clear'
   #define lg_map_key_clear(c)  hid_map_usage_clear(hi, usage, bit, max, EV_KEY, (c))
                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/hid.h:1020:2: note: Calling 'hid_map_usage'
           hid_map_usage(hidinput, usage, bit, max, type, c);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/hid.h:974:2: note: 'input' initialized here
           struct input_dev *input = hidinput->input;
           ^~~~~~~~~~~~~~~~~~~~~~~
   include/linux/hid.h:978:2: note: Control jumps to 'case 1:'  at line 987
           switch (type) {
           ^
   include/linux/hid.h:990:3: note:  Execution continues on line 997
                   break;
                   ^
   include/linux/hid.h:997:15: note: 'c' is <= 'limit'
           if (unlikely(c > limit || !bmap)) {
                        ^
   include/linux/compiler.h:78:42: note: expanded from macro 'unlikely'
   # define unlikely(x)    __builtin_expect(!!(x), 0)
                                               ^
   include/linux/hid.h:997:15: note: Left side of '||' is false
           if (unlikely(c > limit || !bmap)) {
                        ^
   include/linux/hid.h:997:28: note: Assuming 'bmap' is null
           if (unlikely(c > limit || !bmap)) {
                                     ^
   include/linux/compiler.h:78:42: note: expanded from macro 'unlikely'
   # define unlikely(x)    __builtin_expect(!!(x), 0)
                                               ^
   include/linux/hid.h:997:28: note: Assuming pointer value is null
           if (unlikely(c > limit || !bmap)) {
                                     ^
   include/linux/compiler.h:78:42: note: expanded from macro 'unlikely'
   # define unlikely(x)    __builtin_expect(!!(x), 0)
                                               ^
   include/linux/hid.h:997:2: note: Taking true branch
           if (unlikely(c > limit || !bmap)) {
           ^
   include/linux/hid.h:998:3: note: Assuming the condition is true
                   pr_warn_ratelimited("%s: Invalid code %d type %d\n",
                   ^
   include/linux/printk.h:528:2: note: expanded from macro 'pr_warn_ratelimited'
           printk_ratelimited(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__)
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/printk.h:511:6: note: expanded from macro 'printk_ratelimited'
           if (__ratelimit(&_rs))                                          \
               ^~~~~~~~~~~~~~~~~
   include/linux/ratelimit_types.h:41:28: note: expanded from macro '__ratelimit'
   #define __ratelimit(state) ___ratelimit(state, __func__)
                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/hid.h:998:3: note: Taking true branch
                   pr_warn_ratelimited("%s: Invalid code %d type %d\n",
                   ^
   include/linux/printk.h:528:2: note: expanded from macro 'pr_warn_ratelimited'
           printk_ratelimited(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__)
           ^
   include/linux/printk.h:511:2: note: expanded from macro 'printk_ratelimited'
           if (__ratelimit(&_rs))                                          \
           ^
   include/linux/hid.h:999:9: note: Access to field 'name' results in a dereference of a null pointer (loaded from variable 'input')
                                       input->name, c, type);
                                       ^
   include/linux/printk.h:528:49: note: expanded from macro 'pr_warn_ratelimited'
           printk_ratelimited(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__)
                                                          ^~~~~~~~~~~
   include/linux/printk.h:512:17: note: expanded from macro 'printk_ratelimited'
                   printk(fmt, ##__VA_ARGS__);                             \
                                 ^~~~~~~~~~~
   3 warnings generated.
>> drivers/thermal/qcom/qcom-spmi-adc-tm5.c:332:2: warning: Value stored to 'chip' is never read [clang-analyzer-deadcode.DeadStores]
           chip = channel->chip;
           ^      ~~~~~~~~~~~~~
   drivers/thermal/qcom/qcom-spmi-adc-tm5.c:332:2: note: Value stored to 'chip' is never read
           chip = channel->chip;
           ^      ~~~~~~~~~~~~~
   drivers/thermal/qcom/qcom-spmi-adc-tm5.c:379:33: warning: The right operand of '>=' is a garbage value [clang-analyzer-core.UndefinedBinaryOperatorResult]
                   if (chip->channels[i].channel >= channels_available) {
                                                 ^
   drivers/thermal/qcom/qcom-spmi-adc-tm5.c:561:6: note: Assuming 'regmap' is non-null
           if (!regmap)
               ^~~~~~~
   drivers/thermal/qcom/qcom-spmi-adc-tm5.c:561:2: note: Taking false branch
           if (!regmap)
           ^
   drivers/thermal/qcom/qcom-spmi-adc-tm5.c:565:6: note: 'ret' is 0
           if (ret)
               ^~~
   drivers/thermal/qcom/qcom-spmi-adc-tm5.c:565:2: note: Taking false branch
           if (ret)
           ^
   drivers/thermal/qcom/qcom-spmi-adc-tm5.c:569:6: note: Assuming 'adc_tm' is non-null
           if (!adc_tm)
               ^~~~~~~
   drivers/thermal/qcom/qcom-spmi-adc-tm5.c:569:2: note: Taking false branch
           if (!adc_tm)
           ^
   drivers/thermal/qcom/qcom-spmi-adc-tm5.c:577:6: note: Assuming 'irq' is >= 0
           if (irq < 0) {
               ^~~~~~~
   drivers/thermal/qcom/qcom-spmi-adc-tm5.c:577:2: note: Taking false branch
           if (irq < 0) {
           ^
   drivers/thermal/qcom/qcom-spmi-adc-tm5.c:583:6: note: 'ret' is 0
           if (ret) {
               ^~~
   drivers/thermal/qcom/qcom-spmi-adc-tm5.c:583:2: note: Taking false branch
           if (ret) {
           ^
   drivers/thermal/qcom/qcom-spmi-adc-tm5.c:588:8: note: Calling 'adc_tm5_init'
           ret = adc_tm5_init(adc_tm);
                 ^~~~~~~~~~~~~~~~~~~~
   drivers/thermal/qcom/qcom-spmi-adc-tm5.c:374:13: note: 'channels_available' declared without an initial value
           u8 buf[4], channels_available;
                      ^~~~~~~~~~~~~~~~~~
   drivers/thermal/qcom/qcom-spmi-adc-tm5.c:378:14: note: 'i' is < field 'nchannels'
           for (i = 0; i < chip->nchannels; i++) {
                       ^
   drivers/thermal/qcom/qcom-spmi-adc-tm5.c:378:2: note: Loop condition is true.  Entering loop body
           for (i = 0; i < chip->nchannels; i++) {
           ^
   drivers/thermal/qcom/qcom-spmi-adc-tm5.c:379:33: note: The right operand of '>=' is a garbage value
                   if (chip->channels[i].channel >= channels_available) {
                                                 ^  ~~~~~~~~~~~~~~~~~~
   Suppressed 1 warnings (1 with check filters).
   1 warning generated.
   Suppressed 1 warnings (1 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.
   1 warning generated.
   Suppressed 1 warnings (1 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 (1 in non-user code, 1 with check filters).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   1 warning generated.
   Suppressed 1 warnings (1 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.
   1 warning generated.
   Suppressed 1 warnings (1 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.
   1 warning generated.
   Suppressed 1 warnings (1 with check filters).
   1 warning generated.
   Suppressed 1 warnings (1 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.
   drivers/iio/adc/ad7476.c:37:8: warning: Excessive padding in 'struct ad7476_state' (40 padding bytes, where 8 is optimal). 
   Optimal fields order: 
   data, 
   spi, 
   chip_info, 
   reg, 
   convst_gpio, 
   msg, 
   xfer, 
   consider reordering the fields or adding explicit padding members [clang-analyzer-optin.performance.Padding]
   struct ad7476_state {
   ~~~~~~~^~~~~~~~~~~~~~
   drivers/iio/adc/ad7476.c:37:8: note: Excessive padding in 'struct ad7476_state' (40 padding bytes, where 8 is optimal). Optimal fields order: data, spi, chip_info, reg, convst_gpio, msg, xfer, consider reordering the fields or adding explicit padding members
   struct ad7476_state {
   ~~~~~~~^~~~~~~~~~~~~~
   Suppressed 1 warnings (1 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.
   1 warning generated.
   Suppressed 1 warnings (1 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.
   1 warning generated.
   Suppressed 1 warnings (1 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).

vim +/chip +332 drivers/thermal/qcom/qcom-spmi-adc-tm5.c

ca66dca5eda6bd Dmitry Baryshkov 2021-02-05  322  
ca66dca5eda6bd Dmitry Baryshkov 2021-02-05  323  static int adc_tm5_set_trips(void *data, int low, int high)
ca66dca5eda6bd Dmitry Baryshkov 2021-02-05  324  {
ca66dca5eda6bd Dmitry Baryshkov 2021-02-05  325  	struct adc_tm5_channel *channel = data;
ca66dca5eda6bd Dmitry Baryshkov 2021-02-05  326  	struct adc_tm5_chip *chip;
ca66dca5eda6bd Dmitry Baryshkov 2021-02-05  327  	int ret;
ca66dca5eda6bd Dmitry Baryshkov 2021-02-05  328  
ca66dca5eda6bd Dmitry Baryshkov 2021-02-05  329  	if (!channel)
ca66dca5eda6bd Dmitry Baryshkov 2021-02-05  330  		return -EINVAL;
ca66dca5eda6bd Dmitry Baryshkov 2021-02-05  331  
ca66dca5eda6bd Dmitry Baryshkov 2021-02-05 @332  	chip = channel->chip;
ca66dca5eda6bd Dmitry Baryshkov 2021-02-05  333  	dev_dbg(chip->dev, "%d:low(mdegC):%d, high(mdegC):%d\n",
ca66dca5eda6bd Dmitry Baryshkov 2021-02-05  334  		channel->channel, low, high);
ca66dca5eda6bd Dmitry Baryshkov 2021-02-05  335  
ca66dca5eda6bd Dmitry Baryshkov 2021-02-05  336  	if (high == INT_MAX && low <= -INT_MAX)
ca66dca5eda6bd Dmitry Baryshkov 2021-02-05  337  		ret = adc_tm5_disable_channel(channel);
ca66dca5eda6bd Dmitry Baryshkov 2021-02-05  338  	else
ca66dca5eda6bd Dmitry Baryshkov 2021-02-05  339  		ret = adc_tm5_configure(channel, low, high);
ca66dca5eda6bd Dmitry Baryshkov 2021-02-05  340  
ca66dca5eda6bd Dmitry Baryshkov 2021-02-05  341  	return ret;
ca66dca5eda6bd Dmitry Baryshkov 2021-02-05  342  }
ca66dca5eda6bd Dmitry Baryshkov 2021-02-05  343  

---
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: 36570 bytes --]

                 reply	other threads:[~2021-11-21 17:19 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=202111220108.io1PyJ0c-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=kbuild@lists.01.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.