:::::: 
:::::: Manual check reason: "low confidence static check warning: 
drivers/pinctrl/pinctrl-rockchip.c:912:17: warning: Value stored to 'dev' 
during its initialization is never read [clang-analyzer-deadcode.DeadStores]"
:::::: 

CC: [email protected]
CC: [email protected]
BCC: [email protected]
CC: [email protected]
TO: Andy Shevchenko <[email protected]>
CC: Heiko Stuebner <[email protected]>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   e71e60cd74df9386c3f684c54888f2367050b831
commit: e4dd7fd5ff0acb3f3ed290f52afe20fd840d22b0 pinctrl/rockchip: Use 
temporary variable for struct device
date:   7 months ago
:::::: branch date: 2 hours ago
:::::: commit date: 7 months ago
config: mips-randconfig-c004-20220604 
(https://download.01.org/0day-ci/archive/20220607/[email protected]/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 
b364c76683f8ef241025a9556300778c07b590c2)
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 mips cross compiling tool for clang build
        # apt-get install binutils-mips-linux-gnu
        # 
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=e4dd7fd5ff0acb3f3ed290f52afe20fd840d22b0
        git remote add linus 
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout e4dd7fd5ff0acb3f3ed290f52afe20fd840d22b0
        # save the config file
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=mips 
clang-analyzer 

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <[email protected]>


clang-analyzer warnings: (new ones prefixed by >>)
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/leds/led-core.c:431:12: note: Field 'label' is null
           if (props.label) {
                     ^
   drivers/leds/led-core.c:431:2: note: Taking false branch
           if (props.label) {
           ^
   drivers/leds/led-core.c:445:19: note: Field 'function' is null
           } else if (props.function || props.color_present) {
                            ^
   drivers/leds/led-core.c:445:13: note: Left side of '||' is false
           } else if (props.function || props.color_present) {
                      ^
   drivers/leds/led-core.c:445:37: note: Field 'color_present' is false
           } else if (props.function || props.color_present) {
                                              ^
   drivers/leds/led-core.c:445:9: note: Taking false branch
           } else if (props.function || props.color_present) {
                  ^
   drivers/leds/led-core.c:464:13: note: Assuming field 'default_label' is null
           } else if (init_data->default_label) {
                      ^~~~~~~~~~~~~~~~~~~~~~~~
   drivers/leds/led-core.c:464:9: note: Taking false branch
           } else if (init_data->default_label) {
                  ^
   drivers/leds/led-core.c:471:13: note: Assuming the condition is true
           } else if (is_of_node(fwnode)) {
                      ^~~~~~~~~~~~~~~~~~
   drivers/leds/led-core.c:471:9: note: Taking true branch
           } else if (is_of_node(fwnode)) {
                  ^
   drivers/leds/led-core.c:472:30: note: Assuming the condition is false
                   strscpy(led_classdev_name, to_of_node(fwnode)->name,
                                              ^
   include/linux/of.h:164:3: note: expanded from macro 'to_of_node'
                   is_of_node(__to_of_node_fwnode) ?                       \
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/leds/led-core.c:472:30: note: '?' condition is false
                   strscpy(led_classdev_name, to_of_node(fwnode)->name,
                                              ^
   include/linux/of.h:164:3: note: expanded from macro 'to_of_node'
                   is_of_node(__to_of_node_fwnode) ?                       \
                   ^
   drivers/leds/led-core.c:472:30: note: Access to field 'name' results in a 
dereference of a null pointer
                   strscpy(led_classdev_name, to_of_node(fwnode)->name,
                                              ^
   include/linux/of.h:161:2: note: expanded from macro 'to_of_node'
           ({                                                              \
           ^
   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.
   4 warnings generated.
   drivers/regulator/mt6360-regulator.c:243:74: warning: The result of the left 
shift is undefined because the right operand is negative 
[clang-analyzer-core.UndefinedBinaryOperatorResult]
           ret = regmap_update_bits(regmap, rdesc->mode_reg, rdesc->mode_mask, 
val << shift);
                                                                                
   ^  ~~~~~
   drivers/regulator/mt6360-regulator.c:225:2: note: 'shift' initialized to -1
           int shift = ffs(rdesc->mode_mask) - 1;
           ^~~~~~~~~
   drivers/regulator/mt6360-regulator.c:229:2: note: Control jumps to 'case 4:' 
 at line 236
           switch (mode) {
           ^
   drivers/regulator/mt6360-regulator.c:238:3: note:  Execution continues on 
line 243
                   break;
                   ^
   drivers/regulator/mt6360-regulator.c:243:74: note: The result of the left 
shift is undefined because the right operand is negative
           ret = regmap_update_bits(regmap, rdesc->mode_reg, rdesc->mode_mask, 
val << shift);
                                                                                
   ^  ~~~~~
   drivers/regulator/mt6360-regulator.c:265:6: warning: Assigned value is 
garbage or undefined [clang-analyzer-core.uninitialized.Assign]
           val >>= shift;
               ^   ~~~~~
   drivers/regulator/mt6360-regulator.c:256:2: note: 'shift' initialized to -1
           int shift = ffs(rdesc->mode_mask) - 1;
           ^~~~~~~~~
   drivers/regulator/mt6360-regulator.c:261:6: note: Assuming 'ret' is 0
           if (ret)
               ^~~
   drivers/regulator/mt6360-regulator.c:261:2: note: Taking false branch
           if (ret)
           ^
   drivers/regulator/mt6360-regulator.c:265:6: note: Assigned value is garbage 
or undefined
           val >>= shift;
               ^   ~~~~~
   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 (2 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.
   3 warnings generated.
   Suppressed 3 warnings (2 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.
   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.
   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.
   8 warnings generated.
>> drivers/pinctrl/pinctrl-rockchip.c:912:17: warning: Value stored to 'dev' 
>> during its initialization is never read [clang-analyzer-deadcode.DeadStores]
           struct device *dev = info->dev;
                          ^~~   ~~~~~~~~~
   drivers/pinctrl/pinctrl-rockchip.c:912:17: note: Value stored to 'dev' 
during its initialization is never read
           struct device *dev = info->dev;
                          ^~~   ~~~~~~~~~
   drivers/pinctrl/pinctrl-rockchip.c:1965:17: warning: Value stored to 'dev' 
during its initialization is never read [clang-analyzer-deadcode.DeadStores]
           struct device *dev = info->dev;
                          ^~~   ~~~~~~~~~
   drivers/pinctrl/pinctrl-rockchip.c:1965:17: note: Value stored to 'dev' 
during its initialization is never read
           struct device *dev = info->dev;
                          ^~~   ~~~~~~~~~
   drivers/pinctrl/pinctrl-rockchip.c:2031:17: warning: Value stored to 'dev' 
during its initialization is never read [clang-analyzer-deadcode.DeadStores]
           struct device *dev = info->dev;
                          ^~~   ~~~~~~~~~
   drivers/pinctrl/pinctrl-rockchip.c:2031:17: note: Value stored to 'dev' 
during its initialization is never read
           struct device *dev = info->dev;
                          ^~~   ~~~~~~~~~
   include/linux/list.h:137:13: warning: Use of memory after it is freed 
[clang-analyzer-unix.Malloc]
           __list_del(entry->prev, entry->next);
                      ^
   drivers/pinctrl/pinctrl-rockchip.c:2759:14: note: Assuming 'i' is < field 
'nr_banks'
           for (i = 0; i < info->ctrl->nr_banks; i++) {
                       ^~~~~~~~~~~~~~~~~~~~~~~~
   drivers/pinctrl/pinctrl-rockchip.c:2759:2: note: Loop condition is true.  
Entering loop body
           for (i = 0; i < info->ctrl->nr_banks; i++) {
           ^
   drivers/pinctrl/pinctrl-rockchip.c:2763:3: note: Loop condition is true.  
Entering loop body
                   while (!list_empty(&bank->deferred_output)) {
                   ^
   drivers/pinctrl/pinctrl-rockchip.c:2767:4: note: Memory is released
                           kfree(cfg);
                           ^~~~~~~~~~
   drivers/pinctrl/pinctrl-rockchip.c:2763:3: note: Loop condition is true.  
Entering loop body
                   while (!list_empty(&bank->deferred_output)) {
                   ^
   drivers/pinctrl/pinctrl-rockchip.c:2766:4: note: Calling 'list_del'
                           list_del(&cfg->head);
                           ^~~~~~~~~~~~~~~~~~~~
   include/linux/list.h:148:2: note: Calling '__list_del_entry'
           __list_del_entry(entry);
           ^~~~~~~~~~~~~~~~~~~~~~~
   include/linux/list.h:134:6: note: Assuming the condition is false
           if (!__list_del_entry_valid(entry))
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/list.h:134:2: note: Taking false branch
           if (!__list_del_entry_valid(entry))
           ^
   include/linux/list.h:137:13: note: Use of memory after it is freed
           __list_del(entry->prev, entry->next);
                      ^~~~~~~~~~~
   include/linux/list.h:149:14: warning: Use of memory after it is freed 
[clang-analyzer-unix.Malloc]
           entry->next = LIST_POISON1;
                       ^
   drivers/pinctrl/pinctrl-rockchip.c:2759:14: note: Assuming 'i' is < field 
'nr_banks'
           for (i = 0; i < info->ctrl->nr_banks; i++) {
                       ^~~~~~~~~~~~~~~~~~~~~~~~
   drivers/pinctrl/pinctrl-rockchip.c:2759:2: note: Loop condition is true.  
Entering loop body
           for (i = 0; i < info->ctrl->nr_banks; i++) {
           ^
   drivers/pinctrl/pinctrl-rockchip.c:2763:3: note: Loop condition is true.  
Entering loop body
                   while (!list_empty(&bank->deferred_output)) {
                   ^
   drivers/pinctrl/pinctrl-rockchip.c:2767:4: note: Memory is released
                           kfree(cfg);
                           ^~~~~~~~~~
   drivers/pinctrl/pinctrl-rockchip.c:2763:3: note: Loop condition is true.  
Entering loop body
                   while (!list_empty(&bank->deferred_output)) {
                   ^
   drivers/pinctrl/pinctrl-rockchip.c:2766:4: note: Calling 'list_del'
                           list_del(&cfg->head);
                           ^~~~~~~~~~~~~~~~~~~~
   include/linux/list.h:149:14: note: Use of memory after it is freed
           entry->next = LIST_POISON1;
           ~~~~~~~~~~~ ^
   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.
   17 warnings generated.
   fs/io_uring.c:1201:7: warning: Dereference of null pointer 
[clang-analyzer-core.NullDereference]
           if (!wq_list_empty(&ctx->submit_state.compl_reqs))
                ^
   fs/io-wq.h:38:30: note: expanded from macro 'wq_list_empty'
   #define wq_list_empty(list)     (READ_ONCE((list)->first) == NULL)
                                    ^
   include/asm-generic/rwonce.h:50:2: note: expanded from macro 'READ_ONCE'
           __READ_ONCE(x);                                                 \
           ^
   include/asm-generic/rwonce.h:44:24: note: expanded from macro '__READ_ONCE'
   #define __READ_ONCE(x)  (*(const volatile __unqual_scalar_typeof(x) *)&(x))
                           ^
   fs/io_uring.c:2175:2: note: 'ctx' initialized to a null pointer value
           struct io_ring_ctx *ctx = NULL;
           ^~~~~~~~~~~~~~~~~~~~~~~
   fs/io_uring.c:2179:2: note: Loop condition is true.  Entering loop body
           while (1) {
           ^
   fs/io_uring.c:2182:7: note: Assuming field 'first' is non-null
                   if (!tctx->task_list.first && locked)
                       ^~~~~~~~~~~~~~~~~~~~~~
   fs/io_uring.c:2182:30: note: Left side of '&&' is false
                   if (!tctx->task_list.first && locked)

vim +/dev +912 drivers/pinctrl/pinctrl-rockchip.c

05709c3e88f5f0 John Keeping    2017-03-23  895  
d3e5116119bd02 Heiko Stübner   2013-06-10  896  /*
d3e5116119bd02 Heiko Stübner   2013-06-10  897   * Set a new mux function for a 
pin.
d3e5116119bd02 Heiko Stübner   2013-06-10  898   *
d3e5116119bd02 Heiko Stübner   2013-06-10  899   * The register is divided into 
the upper and lower 16 bit. When changing
d3e5116119bd02 Heiko Stübner   2013-06-10  900   * a value, the previous 
register value is not read and changed. Instead
d3e5116119bd02 Heiko Stübner   2013-06-10  901   * it seems the changed bits 
are marked in the upper 16 bit, while the
d3e5116119bd02 Heiko Stübner   2013-06-10  902   * changed value gets set in 
the same offset in the lower 16 bit.
d3e5116119bd02 Heiko Stübner   2013-06-10  903   * All pin settings seem to be 
2 bit wide in both the upper and lower
d3e5116119bd02 Heiko Stübner   2013-06-10  904   * parts.
d3e5116119bd02 Heiko Stübner   2013-06-10  905   * @bank: pin bank to change
d3e5116119bd02 Heiko Stübner   2013-06-10  906   * @pin: pin to change
d3e5116119bd02 Heiko Stübner   2013-06-10  907   * @mux: new mux function to set
d3e5116119bd02 Heiko Stübner   2013-06-10  908   */
14797189b35e9e Heiko Stübner   2014-03-26  909  static int 
rockchip_set_mux(struct rockchip_pin_bank *bank, int pin, int mux)
d3e5116119bd02 Heiko Stübner   2013-06-10  910  {
d3e5116119bd02 Heiko Stübner   2013-06-10  911          struct rockchip_pinctrl 
*info = bank->drvdata;
e4dd7fd5ff0acb Andy Shevchenko 2021-11-05 @912          struct device *dev = 
info->dev;
fc72c923e50d5c Heiko Stübner   2014-06-16  913          int iomux_num = (pin / 
8);
95ec8ae4498e99 Heiko Stübner   2014-06-16  914          struct regmap *regmap;
ea262ad6e4019f david.wu        2017-02-10  915          int reg, ret, mask, 
mux_type;
d3e5116119bd02 Heiko Stübner   2013-06-10  916          u8 bit;
51ff47aa4c933f Heiko Stuebner  2018-11-11  917          u32 data, rmask, 
route_location, route_reg, route_val;
d3e5116119bd02 Heiko Stübner   2013-06-10  918  
05709c3e88f5f0 John Keeping    2017-03-23  919          ret = 
rockchip_verify_mux(bank, pin, mux);
05709c3e88f5f0 John Keeping    2017-03-23  920          if (ret < 0)
05709c3e88f5f0 John Keeping    2017-03-23  921                  return ret;
62f49226b03b64 Heiko Stübner   2014-06-16  922  
05709c3e88f5f0 John Keeping    2017-03-23  923          if 
(bank->iomux[iomux_num].type & IOMUX_GPIO_ONLY)
c4a532dee6b6e4 Heiko Stübner   2014-03-26  924                  return 0;
c4a532dee6b6e4 Heiko Stübner   2014-03-26  925  
e4dd7fd5ff0acb Andy Shevchenko 2021-11-05  926          dev_dbg(dev, "setting 
mux of GPIO%d-%d to %d\n", bank->bank_num, pin, mux);
d3e5116119bd02 Heiko Stübner   2013-06-10  927  
95ec8ae4498e99 Heiko Stübner   2014-06-16  928          regmap = 
(bank->iomux[iomux_num].type & IOMUX_SOURCE_PMU)
95ec8ae4498e99 Heiko Stübner   2014-06-16  929                                  
? info->regmap_pmu : info->regmap_base;
95ec8ae4498e99 Heiko Stübner   2014-06-16  930  
d3e5116119bd02 Heiko Stübner   2013-06-10  931          /* get basic quadrupel 
of mux registers and the correct reg inside */
ea262ad6e4019f david.wu        2017-02-10  932          mux_type = 
bank->iomux[iomux_num].type;
6bc0d121a95b31 Heiko Stübner   2014-06-16  933          reg = 
bank->iomux[iomux_num].offset;
ea262ad6e4019f david.wu        2017-02-10  934          if (mux_type & 
IOMUX_WIDTH_4BIT) {
03716e1dd01b0e Heiko Stübner   2014-06-16  935                  if ((pin % 8) 
>= 4)
03716e1dd01b0e Heiko Stübner   2014-06-16  936                          reg += 
0x4;
03716e1dd01b0e Heiko Stübner   2014-06-16  937                  bit = (pin % 4) 
* 4;
8b6c6f930da9d2 david.wu        2017-02-10  938                  mask = 0xf;
ea262ad6e4019f david.wu        2017-02-10  939          } else if (mux_type & 
IOMUX_WIDTH_3BIT) {
8b6c6f930da9d2 david.wu        2017-02-10  940                  if ((pin % 8) 
>= 5)
8b6c6f930da9d2 david.wu        2017-02-10  941                          reg += 
0x4;
8b6c6f930da9d2 david.wu        2017-02-10  942                  bit = (pin % 8 
% 5) * 3;
8b6c6f930da9d2 david.wu        2017-02-10  943                  mask = 0x7;
03716e1dd01b0e Heiko Stübner   2014-06-16  944          } else {
d3e5116119bd02 Heiko Stübner   2013-06-10  945                  bit = (pin % 8) 
* 2;
8b6c6f930da9d2 david.wu        2017-02-10  946                  mask = 0x3;
03716e1dd01b0e Heiko Stübner   2014-06-16  947          }
d3e5116119bd02 Heiko Stübner   2013-06-10  948  
c04c3fa65ac5c6 David Wu        2017-07-21  949          if (bank->recalced_mask 
& BIT(pin))
c04c3fa65ac5c6 David Wu        2017-07-21  950                  
rockchip_get_recalced_mux(bank, pin, &reg, &bit, &mask);
ea262ad6e4019f david.wu        2017-02-10  951  
bd35b9bf828433 David Wu        2017-05-26  952          if (bank->route_mask & 
BIT(pin)) {
51ff47aa4c933f Heiko Stuebner  2018-11-11  953                  if 
(rockchip_get_mux_route(bank, pin, mux, &route_location,
51ff47aa4c933f Heiko Stuebner  2018-11-11  954                                  
           &route_reg, &route_val)) {
51ff47aa4c933f Heiko Stuebner  2018-11-11  955                          struct 
regmap *route_regmap = regmap;
51ff47aa4c933f Heiko Stuebner  2018-11-11  956  
51ff47aa4c933f Heiko Stuebner  2018-11-11  957                          /* 
handle special locations */
51ff47aa4c933f Heiko Stuebner  2018-11-11  958                          switch 
(route_location) {
51ff47aa4c933f Heiko Stuebner  2018-11-11  959                          case 
ROCKCHIP_ROUTE_PMU:
51ff47aa4c933f Heiko Stuebner  2018-11-11  960                                  
route_regmap = info->regmap_pmu;
51ff47aa4c933f Heiko Stuebner  2018-11-11  961                                  
break;
51ff47aa4c933f Heiko Stuebner  2018-11-11  962                          case 
ROCKCHIP_ROUTE_GRF:
51ff47aa4c933f Heiko Stuebner  2018-11-11  963                                  
route_regmap = info->regmap_base;
51ff47aa4c933f Heiko Stuebner  2018-11-11  964                                  
break;
51ff47aa4c933f Heiko Stuebner  2018-11-11  965                          }
51ff47aa4c933f Heiko Stuebner  2018-11-11  966  
51ff47aa4c933f Heiko Stuebner  2018-11-11  967                          ret = 
regmap_write(route_regmap, route_reg, route_val);
bd35b9bf828433 David Wu        2017-05-26  968                          if (ret)
bd35b9bf828433 David Wu        2017-05-26  969                                  
return ret;
bd35b9bf828433 David Wu        2017-05-26  970                  }
bd35b9bf828433 David Wu        2017-05-26  971          }
bd35b9bf828433 David Wu        2017-05-26  972  
03716e1dd01b0e Heiko Stübner   2014-06-16  973          data = (mask << (bit + 
16));
99e872d953fb44 Sonny Rao       2014-07-31  974          rmask = data | (data >> 
16);
03716e1dd01b0e Heiko Stübner   2014-06-16  975          data |= (mux & mask) << 
bit;
99e872d953fb44 Sonny Rao       2014-07-31  976          ret = 
regmap_update_bits(regmap, reg, rmask, data);
d3e5116119bd02 Heiko Stübner   2013-06-10  977  
751a99aba47e9b Heiko Stübner   2014-05-05  978          return ret;
d3e5116119bd02 Heiko Stübner   2013-06-10  979  }
d3e5116119bd02 Heiko Stübner   2013-06-10  980  

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp
_______________________________________________
kbuild mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to