All of lore.kernel.org
 help / color / mirror / Atom feed
* drivers/media/platform/atmel/atmel-isc-clk.c:125:18: warning: Value stored to 'isc_clk' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
@ 2022-04-07 12:51 kernel test robot
  0 siblings, 0 replies; 5+ messages in thread
From: kernel test robot @ 2022-04-07 12:51 UTC (permalink / raw)
  To: kbuild

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

CC: llvm(a)lists.linux.dev
CC: kbuild-all(a)lists.01.org
BCC: lkp(a)intel.com
CC: linux-kernel(a)vger.kernel.org
TO: Eugen Hristev <eugen.hristev@microchip.com>
CC: Mauro Carvalho Chehab <mchehab@kernel.org>
CC: linux-media(a)vger.kernel.org
CC: Jacopo Mondi <jacopo+renesas@jmondi.org>
CC: Hans Verkuil <hverkuil@xs4all.nl>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   3e732ebf7316ac83e8562db7e64cc68aec390a18
commit: 118bf76a35bc2ed061cd1454fe5e57d1c7bcd8d0 media: atmel: atmel-isc: split the clock code into separate source file
date:   2 months ago
:::::: branch date: 2 days ago
:::::: commit date: 2 months ago
config: arm-randconfig-c002-20220407 (https://download.01.org/0day-ci/archive/20220407/202204072054.8OocMxHK-lkp(a)intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 6b306233f78876a1d197ed6e1f05785505de7c63)
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=118bf76a35bc2ed061cd1454fe5e57d1c7bcd8d0
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout 118bf76a35bc2ed061cd1454fe5e57d1c7bcd8d0
        # save the config file 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 >>)
   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.
   drivers/iio/adc/ti-ads8688.c:64:8: warning: Excessive padding in 'struct ads8688_state' (44 padding bytes, where 12 is optimal). 
   Optimal fields order: 
   data, 
   chip_info, 
   spi, 
   reg, 
   vref_mv, 
   lock, 
   range, 
   consider reordering the fields or adding explicit padding members [clang-analyzer-optin.performance.Padding]
   struct ads8688_state {
   ~~~~~~~^~~~~~~~~~~~~~~
   drivers/iio/adc/ti-ads8688.c:64:8: note: Excessive padding in 'struct ads8688_state' (44 padding bytes, where 12 is optimal). Optimal fields order: data, chip_info, spi, reg, vref_mv, lock, range, consider reordering the fields or adding explicit padding members
   struct ads8688_state {
   ~~~~~~~^~~~~~~~~~~~~~~
   Suppressed 1 warnings (1 with check filters).
   1 warning generated.
   drivers/iio/adc/twl6030-gpadc.c:911:2: warning: Value stored to 'ret' is never read [clang-analyzer-deadcode.DeadStores]
           ret = devm_request_threaded_irq(dev, irq, NULL,
           ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/iio/adc/twl6030-gpadc.c:911:2: note: Value stored to 'ret' is never read
           ret = devm_request_threaded_irq(dev, irq, NULL,
           ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   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.
   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.
   3 warnings generated.
   net/strparser/strparser.c:161:5: warning: Value stored to 'head' is never read [clang-analyzer-deadcode.DeadStores]
                                   head = skb;
                                   ^      ~~~
   net/strparser/strparser.c:161:5: note: Value stored to 'head' is never read
                                   head = skb;
                                   ^      ~~~
   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.
   3 warnings generated.
   fs/ext4/page-io.c:325:11: warning: Value stored to 'bi_sector' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
           sector_t bi_sector = bio->bi_iter.bi_sector;
                    ^~~~~~~~~   ~~~~~~~~~~~~~~~~~~~~~~
   fs/ext4/page-io.c:325:11: note: Value stored to 'bi_sector' during its initialization is never read
           sector_t bi_sector = bio->bi_iter.bi_sector;
                    ^~~~~~~~~   ~~~~~~~~~~~~~~~~~~~~~~
   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 with check filters).
   1 warning generated.
   drivers/iio/proximity/vcnl3020.c:76:8: warning: Excessive padding in 'struct vcnl3020_data' (57 padding bytes, where 25 is optimal). 
   Optimal fields order: 
   buf, 
   rev, 
   regmap, 
   dev, 
   lock, 
   consider reordering the fields or adding explicit padding members [clang-analyzer-optin.performance.Padding]
   struct vcnl3020_data {
   ~~~~~~~^~~~~~~~~~~~~~~
   drivers/iio/proximity/vcnl3020.c:76:8: note: Excessive padding in 'struct vcnl3020_data' (57 padding bytes, where 25 is optimal). Optimal fields order: buf, rev, regmap, dev, lock, consider reordering the fields or adding explicit padding members
   struct vcnl3020_data {
   ~~~~~~~^~~~~~~~~~~~~~~
   5 warnings generated.
   Suppressed 5 warnings (1 in non-user code, 4 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.
   4 warnings generated.
   Suppressed 4 warnings (4 with check filters).
   1 warning generated.
   Suppressed 1 warnings (1 with check filters).
   3 warnings generated.
   net/unix/af_unix.c:1684:3: warning: Value stored to 'err' is never read [clang-analyzer-deadcode.DeadStores]
                   err = 0;
                   ^     ~
   net/unix/af_unix.c:1684:3: note: Value stored to 'err' is never read
                   err = 0;
                   ^     ~
   net/unix/af_unix.c:2689:3: warning: Value stored to 'err' is never read [clang-analyzer-deadcode.DeadStores]
                   err = -EOPNOTSUPP;
                   ^     ~~~~~~~~~~~
   net/unix/af_unix.c:2689:3: note: Value stored to 'err' is never read
                   err = -EOPNOTSUPP;
                   ^     ~~~~~~~~~~~
   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 with check filters).
   1 warning generated.
   Suppressed 1 warnings (1 with check filters).
   2 warnings generated.
>> drivers/media/platform/atmel/atmel-isc-clk.c:125:18: warning: Value stored to 'isc_clk' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
           struct isc_clk *isc_clk = to_isc_clk(hw);
                           ^~~~~~~
   drivers/media/platform/atmel/atmel-isc-clk.c:125:18: note: Value stored to 'isc_clk' during its initialization is never read
           struct isc_clk *isc_clk = to_isc_clk(hw);
                           ^~~~~~~
   Suppressed 1 warnings (1 with check filters).
   1 warning generated.
   Suppressed 1 warnings (1 with check filters).
   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.
   1 warning generated.
   net/ieee802154/nl-mac.c:529:2: warning: Value stored to 'rc' is never read [clang-analyzer-deadcode.DeadStores]
           rc = ops->set_mac_params(dev, &params);
           ^    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/ieee802154/nl-mac.c:529:2: note: Value stored to 'rc' is never read
           rc = ops->set_mac_params(dev, &params);
           ^    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   1 warning generated.
   Suppressed 1 warnings (1 with check filters).
   3 warnings generated.
   net/ipv4/udp.c:742:2: warning: Value stored to 'err' is never read [clang-analyzer-deadcode.DeadStores]
           err = 0;
           ^     ~
   net/ipv4/udp.c:742:2: note: Value stored to 'err' is never read
           err = 0;
           ^     ~
   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 with check filters).
   1 warning generated.
   drivers/iio/potentiometer/ad5272.c:49:8: warning: Excessive padding in 'struct ad5272_data' (58 padding bytes, where 26 is optimal). 
   Optimal fields order: 
   buf, 
   client, 
   cfg, 
   lock, 
   consider reordering the fields or adding explicit padding members [clang-analyzer-optin.performance.Padding]
   struct ad5272_data {
   ~~~~~~~^~~~~~~~~~~~~
   drivers/iio/potentiometer/ad5272.c:49:8: note: Excessive padding in 'struct ad5272_data' (58 padding bytes, where 26 is optimal). Optimal fields order: buf, client, cfg, lock, consider reordering the fields or adding explicit padding members
   struct ad5272_data {
   ~~~~~~~^~~~~~~~~~~~~
   1 warning generated.
   Suppressed 1 warnings (1 with check filters).
   4 warnings generated.
   net/ipv4/route.c:879:2: warning: Value stored to 'log_martians' is never read [clang-analyzer-deadcode.DeadStores]
           log_martians = IN_DEV_LOG_MARTIANS(in_dev);
           ^
   net/ipv4/route.c:879:2: note: Value stored to 'log_martians' is never read
   Suppressed 3 warnings (1 in non-user code, 2 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 with check filters).
   1 warning generated.
   Suppressed 1 warnings (1 with check filters).
   2 warnings generated.
   net/ipv4/ip_fragment.c:619:3: warning: Argument to kfree() is the address of the global variable 'ip4_frags_ns_ctl_table', which is not memory allocated by malloc() [clang-analyzer-unix.Malloc]
                   kfree(table);
                   ^
   net/ipv4/ip_fragment.c:657:6: note: Assuming 'res' is >= 0
           if (res < 0)
               ^~~~~~~
   net/ipv4/ip_fragment.c:657:2: note: Taking false branch
           if (res < 0)
           ^
   net/ipv4/ip_fragment.c:684:8: note: Calling 'ip4_frags_ns_ctl_register'
           res = ip4_frags_ns_ctl_register(net);
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/ipv4/ip_fragment.c:597:6: note: Assuming the condition is false
           if (!net_eq(net, &init_net)) {
               ^~~~~~~~~~~~~~~~~~~~~~~
   net/ipv4/ip_fragment.c:597:2: note: Taking false branch
           if (!net_eq(net, &init_net)) {
           ^
   net/ipv4/ip_fragment.c:611:6: note: Assuming 'hdr' is null
           if (!hdr)
               ^~~~
   net/ipv4/ip_fragment.c:611:2: note: Taking true branch
           if (!hdr)
           ^
   net/ipv4/ip_fragment.c:612:3: note: Control jumps to line 618
                   goto err_reg;
                   ^
   net/ipv4/ip_fragment.c:618:6: note: Assuming the condition is true
           if (!net_eq(net, &init_net))
               ^~~~~~~~~~~~~~~~~~~~~~~
   net/ipv4/ip_fragment.c:618:2: note: Taking true branch
           if (!net_eq(net, &init_net))
           ^
   net/ipv4/ip_fragment.c:619:3: note: Argument to kfree() is the address of the global variable 'ip4_frags_ns_ctl_table', which is not memory allocated by malloc()
                   kfree(table);
                   ^     ~~~~~
   Suppressed 1 warnings (1 with check filters).
   14 warnings generated.
   Suppressed 14 warnings (1 in non-user code, 13 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.

vim +/isc_clk +125 drivers/media/platform/atmel/atmel-isc-clk.c

118bf76a35bc2e Eugen Hristev 2021-12-13  121  
118bf76a35bc2e Eugen Hristev 2021-12-13  122  static int isc_clk_determine_rate(struct clk_hw *hw,
118bf76a35bc2e Eugen Hristev 2021-12-13  123  				  struct clk_rate_request *req)
118bf76a35bc2e Eugen Hristev 2021-12-13  124  {
118bf76a35bc2e Eugen Hristev 2021-12-13 @125  	struct isc_clk *isc_clk = to_isc_clk(hw);
118bf76a35bc2e Eugen Hristev 2021-12-13  126  	long best_rate = -EINVAL;
118bf76a35bc2e Eugen Hristev 2021-12-13  127  	int best_diff = -1;
118bf76a35bc2e Eugen Hristev 2021-12-13  128  	unsigned int i, div;
118bf76a35bc2e Eugen Hristev 2021-12-13  129  
118bf76a35bc2e Eugen Hristev 2021-12-13  130  	for (i = 0; i < clk_hw_get_num_parents(hw); i++) {
118bf76a35bc2e Eugen Hristev 2021-12-13  131  		struct clk_hw *parent;
118bf76a35bc2e Eugen Hristev 2021-12-13  132  		unsigned long parent_rate;
118bf76a35bc2e Eugen Hristev 2021-12-13  133  
118bf76a35bc2e Eugen Hristev 2021-12-13  134  		parent = clk_hw_get_parent_by_index(hw, i);
118bf76a35bc2e Eugen Hristev 2021-12-13  135  		if (!parent)
118bf76a35bc2e Eugen Hristev 2021-12-13  136  			continue;
118bf76a35bc2e Eugen Hristev 2021-12-13  137  
118bf76a35bc2e Eugen Hristev 2021-12-13  138  		parent_rate = clk_hw_get_rate(parent);
118bf76a35bc2e Eugen Hristev 2021-12-13  139  		if (!parent_rate)
118bf76a35bc2e Eugen Hristev 2021-12-13  140  			continue;
118bf76a35bc2e Eugen Hristev 2021-12-13  141  
118bf76a35bc2e Eugen Hristev 2021-12-13  142  		for (div = 1; div < ISC_CLK_MAX_DIV + 2; div++) {
118bf76a35bc2e Eugen Hristev 2021-12-13  143  			unsigned long rate;
118bf76a35bc2e Eugen Hristev 2021-12-13  144  			int diff;
118bf76a35bc2e Eugen Hristev 2021-12-13  145  
118bf76a35bc2e Eugen Hristev 2021-12-13  146  			rate = DIV_ROUND_CLOSEST(parent_rate, div);
118bf76a35bc2e Eugen Hristev 2021-12-13  147  			diff = abs(req->rate - rate);
118bf76a35bc2e Eugen Hristev 2021-12-13  148  
118bf76a35bc2e Eugen Hristev 2021-12-13  149  			if (best_diff < 0 || best_diff > diff) {
118bf76a35bc2e Eugen Hristev 2021-12-13  150  				best_rate = rate;
118bf76a35bc2e Eugen Hristev 2021-12-13  151  				best_diff = diff;
118bf76a35bc2e Eugen Hristev 2021-12-13  152  				req->best_parent_rate = parent_rate;
118bf76a35bc2e Eugen Hristev 2021-12-13  153  				req->best_parent_hw = parent;
118bf76a35bc2e Eugen Hristev 2021-12-13  154  			}
118bf76a35bc2e Eugen Hristev 2021-12-13  155  
118bf76a35bc2e Eugen Hristev 2021-12-13  156  			if (!best_diff || rate < req->rate)
118bf76a35bc2e Eugen Hristev 2021-12-13  157  				break;
118bf76a35bc2e Eugen Hristev 2021-12-13  158  		}
118bf76a35bc2e Eugen Hristev 2021-12-13  159  
118bf76a35bc2e Eugen Hristev 2021-12-13  160  		if (!best_diff)
118bf76a35bc2e Eugen Hristev 2021-12-13  161  			break;
118bf76a35bc2e Eugen Hristev 2021-12-13  162  	}
118bf76a35bc2e Eugen Hristev 2021-12-13  163  
118bf76a35bc2e Eugen Hristev 2021-12-13  164  	dev_dbg(isc_clk->dev,
118bf76a35bc2e Eugen Hristev 2021-12-13  165  		"ISC CLK: %s, best_rate = %ld, parent clk: %s @ %ld\n",
118bf76a35bc2e Eugen Hristev 2021-12-13  166  		__func__, best_rate,
118bf76a35bc2e Eugen Hristev 2021-12-13  167  		__clk_get_name((req->best_parent_hw)->clk),
118bf76a35bc2e Eugen Hristev 2021-12-13  168  		req->best_parent_rate);
118bf76a35bc2e Eugen Hristev 2021-12-13  169  
118bf76a35bc2e Eugen Hristev 2021-12-13  170  	if (best_rate < 0)
118bf76a35bc2e Eugen Hristev 2021-12-13  171  		return best_rate;
118bf76a35bc2e Eugen Hristev 2021-12-13  172  
118bf76a35bc2e Eugen Hristev 2021-12-13  173  	req->rate = best_rate;
118bf76a35bc2e Eugen Hristev 2021-12-13  174  
118bf76a35bc2e Eugen Hristev 2021-12-13  175  	return 0;
118bf76a35bc2e Eugen Hristev 2021-12-13  176  }
118bf76a35bc2e Eugen Hristev 2021-12-13  177  

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

^ permalink raw reply	[flat|nested] 5+ messages in thread

* drivers/media/platform/atmel/atmel-isc-clk.c:125:18: warning: Value stored to 'isc_clk' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
@ 2022-06-06  2:41 kernel test robot
  0 siblings, 0 replies; 5+ messages in thread
From: kernel test robot @ 2022-06-06  2:41 UTC (permalink / raw)
  To: kbuild

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

:::::: 
:::::: Manual check reason: "low confidence static check warning: drivers/media/platform/atmel/atmel-isc-clk.c:125:18: warning: Value stored to 'isc_clk' during its initialization is never read [clang-analyzer-deadcode.DeadStores]"
:::::: 

CC: llvm(a)lists.linux.dev
CC: kbuild-all(a)lists.01.org
BCC: lkp(a)intel.com
CC: linux-kernel(a)vger.kernel.org
TO: Eugen Hristev <eugen.hristev@microchip.com>
CC: Mauro Carvalho Chehab <mchehab@kernel.org>
CC: linux-media(a)vger.kernel.org
CC: Jacopo Mondi <jacopo+renesas@jmondi.org>
CC: Hans Verkuil <hverkuil@xs4all.nl>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   d717180e7f9775d468f415c10a4a474640146001
commit: 118bf76a35bc2ed061cd1454fe5e57d1c7bcd8d0 media: atmel: atmel-isc: split the clock code into separate source file
date:   4 months ago
:::::: branch date: 8 hours ago
:::::: commit date: 4 months ago
config: arm-randconfig-c002-20220605 (https://download.01.org/0day-ci/archive/20220606/202206060942.zOb08XEA-lkp(a)intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 0a90b72c432d70aae035727ece4ba80ce820f381)
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=118bf76a35bc2ed061cd1454fe5e57d1c7bcd8d0
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout 118bf76a35bc2ed061cd1454fe5e57d1c7bcd8d0
        # save the config file
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm clang-analyzer 

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@intel.com>


clang-analyzer warnings: (new ones prefixed by >>)
           if (WARN_ON(!sysdev->dma_mask))
                        ^
   include/asm-generic/bug.h:166:25: note: expanded from macro 'WARN_ON'
           int __ret_warn_on = !!(condition);                              \
                                  ^~~~~~~~~
   drivers/usb/host/xhci-plat.c:200:6: note: Assuming the condition is false
           if (usb_disabled())
               ^~~~~~~~~~~~~~
   drivers/usb/host/xhci-plat.c:200:2: note: Taking false branch
           if (usb_disabled())
           ^
   drivers/usb/host/xhci-plat.c:206:6: note: Assuming 'irq' is >= 0
           if (irq < 0)
               ^~~~~~~
   drivers/usb/host/xhci-plat.c:206:2: note: Taking false branch
           if (irq < 0)
           ^
   drivers/usb/host/xhci-plat.c:216:28: note: Assuming pointer value is null
           for (sysdev = &pdev->dev; sysdev; sysdev = sysdev->parent) {
                                     ^~~~~~
   drivers/usb/host/xhci-plat.c:216:2: note: Loop condition is false. Execution continues on line 226
           for (sysdev = &pdev->dev; sysdev; sysdev = sysdev->parent) {
           ^
   drivers/usb/host/xhci-plat.c:226:7: note: 'sysdev' is null
           if (!sysdev)
                ^~~~~~
   drivers/usb/host/xhci-plat.c:226:2: note: Taking true branch
           if (!sysdev)
           ^
   drivers/usb/host/xhci-plat.c:227:3: note: Null pointer value stored to 'sysdev'
                   sysdev = &pdev->dev;
                   ^~~~~~~~~~~~~~~~~~~
   drivers/usb/host/xhci-plat.c:230:15: note: Access to field 'dma_mask' results in a dereference of a null pointer (loaded from variable 'sysdev')
           if (WARN_ON(!sysdev->dma_mask))
                        ^
   include/asm-generic/bug.h:166:25: note: expanded from macro 'WARN_ON'
           int __ret_warn_on = !!(condition);                              \
                                  ^~~~~~~~~
   Suppressed 5 warnings (5 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.
   5 warnings generated.
   Suppressed 5 warnings (5 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 with check filters).
   1 warning generated.
   Suppressed 1 warnings (1 with check filters).
   1 warning generated.
   Suppressed 1 warnings (1 with check filters).
   1 warning generated.
   Suppressed 1 warnings (1 with check filters).
   1 warning generated.
   Suppressed 1 warnings (1 with check filters).
   1 warning generated.
   Suppressed 1 warnings (1 with check filters).
   1 warning generated.
   Suppressed 1 warnings (1 with check filters).
   1 warning generated.
   Suppressed 1 warnings (1 with check filters).
   3 warnings generated.
   drivers/media/platform/rockchip/rkisp1/rkisp1-isp.c:479:2: warning: Value stored to 'cif_id' is never read [clang-analyzer-deadcode.DeadStores]
           cif_id = rkisp1_read(rkisp1, RKISP1_CIF_VI_ID);
           ^        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/media/platform/rockchip/rkisp1/rkisp1-isp.c:479:2: note: Value stored to 'cif_id' is never read
           cif_id = rkisp1_read(rkisp1, RKISP1_CIF_VI_ID);
           ^        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/media/platform/rockchip/rkisp1/rkisp1-isp.c:910:24: warning: Value stored to 'rkisp1' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
           struct rkisp1_device *rkisp1 =
                                 ^~~~~~
   drivers/media/platform/rockchip/rkisp1/rkisp1-isp.c:910:24: note: Value stored to 'rkisp1' during its initialization is never read
           struct rkisp1_device *rkisp1 =
                                 ^~~~~~
   Suppressed 1 warnings (1 with check filters).
   1 warning generated.
   Suppressed 1 warnings (1 with check filters).
   1 warning generated.
   Suppressed 1 warnings (1 with check filters).
   1 warning generated.
   Suppressed 1 warnings (1 with check filters).
   1 warning generated.
   Suppressed 1 warnings (1 with check filters).
   1 warning generated.
   Suppressed 1 warnings (1 with check filters).
   1 warning generated.
   Suppressed 1 warnings (1 with check filters).
   1 warning generated.
   Suppressed 1 warnings (1 with check filters).
   1 warning generated.
   Suppressed 1 warnings (1 with check filters).
   1 warning generated.
   Suppressed 1 warnings (1 with check filters).
   1 warning generated.
   Suppressed 1 warnings (1 with check filters).
   1 warning generated.
   Suppressed 1 warnings (1 with check filters).
   1 warning generated.
   Suppressed 1 warnings (1 with check filters).
   2 warnings generated.
>> drivers/media/platform/atmel/atmel-isc-clk.c:125:18: warning: Value stored to 'isc_clk' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
           struct isc_clk *isc_clk = to_isc_clk(hw);
                           ^~~~~~~
   drivers/media/platform/atmel/atmel-isc-clk.c:125:18: note: Value stored to 'isc_clk' during its initialization is never read
           struct isc_clk *isc_clk = to_isc_clk(hw);
                           ^~~~~~~
   Suppressed 1 warnings (1 with check filters).
   1 warning generated.
   Suppressed 1 warnings (1 with check filters).
   1 warning generated.
   Suppressed 1 warnings (1 with check filters).
   1 warning generated.
   Suppressed 1 warnings (1 with check filters).
   1 warning generated.
   Suppressed 1 warnings (1 with check filters).
   2 warnings generated.
   sound/core/device.c:237:2: warning: Use of memory after it is freed [clang-analyzer-unix.Malloc]
           list_for_each_entry_safe_reverse(dev, next, &card->devices, list)
           ^
   include/linux/list.h:773:7: note: expanded from macro 'list_for_each_entry_safe_reverse'
                   n = list_prev_entry(pos, member);                       \
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/list.h:572:2: note: expanded from macro 'list_prev_entry'
           list_entry((pos)->member.prev, typeof(*(pos)), member)
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/list.h:520:2: note: expanded from macro 'list_entry'
           container_of(ptr, type, member)
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/container_of.h:18:25: note: expanded from macro 'container_of'
           void *__mptr = (void *)(ptr);                                   \
                                  ^~~~~
   sound/core/device.c:226:17: note: Assuming 'card' is non-null
           if (snd_BUG_ON(!card))
                          ^
   include/sound/core.h:401:35: note: expanded from macro 'snd_BUG_ON'
   #define snd_BUG_ON(cond)        WARN_ON((cond))
                                            ^~~~
   include/asm-generic/bug.h:166:25: note: expanded from macro 'WARN_ON'
           int __ret_warn_on = !!(condition);                              \
                                  ^~~~~~~~~
   sound/core/device.c:226:2: note: Taking false branch
           if (snd_BUG_ON(!card))
           ^
   sound/core/device.c:228:2: note: Loop condition is true.  Entering loop body
           list_for_each_entry_safe_reverse(dev, next, &card->devices, list) {
           ^
   include/linux/list.h:772:2: note: expanded from macro 'list_for_each_entry_safe_reverse'
           for (pos = list_last_entry(head, typeof(*pos), member),         \
           ^
   sound/core/device.c:230:7: note: Assuming field 'type' is not equal to SNDRV_DEV_CONTROL
                   if (dev->type == SNDRV_DEV_CONTROL ||
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   sound/core/device.c:230:7: note: Left side of '||' is false
   sound/core/device.c:231:7: note: Assuming field 'type' is not equal to SNDRV_DEV_LOWLEVEL
                       dev->type == SNDRV_DEV_LOWLEVEL)
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   sound/core/device.c:230:3: note: Taking false branch
                   if (dev->type == SNDRV_DEV_CONTROL ||
                   ^
   sound/core/device.c:233:3: note: Calling '__snd_device_free'
                   __snd_device_free(dev);
                   ^~~~~~~~~~~~~~~~~~~~~~
   sound/core/device.c:75:6: note: Assuming field 'dev_free' is null
           if (dev->ops->dev_free) {
               ^~~~~~~~~~~~~~~~~~
   sound/core/device.c:75:2: note: Taking false branch
           if (dev->ops->dev_free) {
           ^
   sound/core/device.c:79:2: note: Memory is released
           kfree(dev);
           ^~~~~~~~~~
   sound/core/device.c:233:3: note: Returning; memory was released via 1st parameter
                   __snd_device_free(dev);
                   ^~~~~~~~~~~~~~~~~~~~~~
   sound/core/device.c:228:2: note: Loop condition is false. Execution continues on line 237
           list_for_each_entry_safe_reverse(dev, next, &card->devices, list) {
           ^
   include/linux/list.h:772:2: note: expanded from macro 'list_for_each_entry_safe_reverse'
           for (pos = list_last_entry(head, typeof(*pos), member),         \
           ^
   sound/core/device.c:237:2: note: Use of memory after it is freed
           list_for_each_entry_safe_reverse(dev, next, &card->devices, list)
           ^
   include/linux/list.h:773:7: note: expanded from macro 'list_for_each_entry_safe_reverse'
                   n = list_prev_entry(pos, member);                       \
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/list.h:572:2: note: expanded from macro 'list_prev_entry'
           list_entry((pos)->member.prev, typeof(*(pos)), member)
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/list.h:520:2: note: expanded from macro 'list_entry'
           container_of(ptr, type, member)
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/container_of.h:18:25: note: expanded from macro 'container_of'
           void *__mptr = (void *)(ptr);                                   \
                                  ^~~~~
   4 warnings generated.
   drivers/gpu/drm/bridge/tc358767.c:678:2: warning: Value stored to 'revision' is never read [clang-analyzer-deadcode.DeadStores]
           revision = tc->link.dpcd[DP_DPCD_REV];
           ^          ~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/bridge/tc358767.c:678:2: note: Value stored to 'revision' is never read
           revision = tc->link.dpcd[DP_DPCD_REV];

vim +/isc_clk +125 drivers/media/platform/atmel/atmel-isc-clk.c

118bf76a35bc2e Eugen Hristev 2021-12-13  121  
118bf76a35bc2e Eugen Hristev 2021-12-13  122  static int isc_clk_determine_rate(struct clk_hw *hw,
118bf76a35bc2e Eugen Hristev 2021-12-13  123  				  struct clk_rate_request *req)
118bf76a35bc2e Eugen Hristev 2021-12-13  124  {
118bf76a35bc2e Eugen Hristev 2021-12-13 @125  	struct isc_clk *isc_clk = to_isc_clk(hw);
118bf76a35bc2e Eugen Hristev 2021-12-13  126  	long best_rate = -EINVAL;
118bf76a35bc2e Eugen Hristev 2021-12-13  127  	int best_diff = -1;
118bf76a35bc2e Eugen Hristev 2021-12-13  128  	unsigned int i, div;
118bf76a35bc2e Eugen Hristev 2021-12-13  129  
118bf76a35bc2e Eugen Hristev 2021-12-13  130  	for (i = 0; i < clk_hw_get_num_parents(hw); i++) {
118bf76a35bc2e Eugen Hristev 2021-12-13  131  		struct clk_hw *parent;
118bf76a35bc2e Eugen Hristev 2021-12-13  132  		unsigned long parent_rate;
118bf76a35bc2e Eugen Hristev 2021-12-13  133  
118bf76a35bc2e Eugen Hristev 2021-12-13  134  		parent = clk_hw_get_parent_by_index(hw, i);
118bf76a35bc2e Eugen Hristev 2021-12-13  135  		if (!parent)
118bf76a35bc2e Eugen Hristev 2021-12-13  136  			continue;
118bf76a35bc2e Eugen Hristev 2021-12-13  137  
118bf76a35bc2e Eugen Hristev 2021-12-13  138  		parent_rate = clk_hw_get_rate(parent);
118bf76a35bc2e Eugen Hristev 2021-12-13  139  		if (!parent_rate)
118bf76a35bc2e Eugen Hristev 2021-12-13  140  			continue;
118bf76a35bc2e Eugen Hristev 2021-12-13  141  
118bf76a35bc2e Eugen Hristev 2021-12-13  142  		for (div = 1; div < ISC_CLK_MAX_DIV + 2; div++) {
118bf76a35bc2e Eugen Hristev 2021-12-13  143  			unsigned long rate;
118bf76a35bc2e Eugen Hristev 2021-12-13  144  			int diff;
118bf76a35bc2e Eugen Hristev 2021-12-13  145  
118bf76a35bc2e Eugen Hristev 2021-12-13  146  			rate = DIV_ROUND_CLOSEST(parent_rate, div);
118bf76a35bc2e Eugen Hristev 2021-12-13  147  			diff = abs(req->rate - rate);
118bf76a35bc2e Eugen Hristev 2021-12-13  148  
118bf76a35bc2e Eugen Hristev 2021-12-13  149  			if (best_diff < 0 || best_diff > diff) {
118bf76a35bc2e Eugen Hristev 2021-12-13  150  				best_rate = rate;
118bf76a35bc2e Eugen Hristev 2021-12-13  151  				best_diff = diff;
118bf76a35bc2e Eugen Hristev 2021-12-13  152  				req->best_parent_rate = parent_rate;
118bf76a35bc2e Eugen Hristev 2021-12-13  153  				req->best_parent_hw = parent;
118bf76a35bc2e Eugen Hristev 2021-12-13  154  			}
118bf76a35bc2e Eugen Hristev 2021-12-13  155  
118bf76a35bc2e Eugen Hristev 2021-12-13  156  			if (!best_diff || rate < req->rate)
118bf76a35bc2e Eugen Hristev 2021-12-13  157  				break;
118bf76a35bc2e Eugen Hristev 2021-12-13  158  		}
118bf76a35bc2e Eugen Hristev 2021-12-13  159  
118bf76a35bc2e Eugen Hristev 2021-12-13  160  		if (!best_diff)
118bf76a35bc2e Eugen Hristev 2021-12-13  161  			break;
118bf76a35bc2e Eugen Hristev 2021-12-13  162  	}
118bf76a35bc2e Eugen Hristev 2021-12-13  163  
118bf76a35bc2e Eugen Hristev 2021-12-13  164  	dev_dbg(isc_clk->dev,
118bf76a35bc2e Eugen Hristev 2021-12-13  165  		"ISC CLK: %s, best_rate = %ld, parent clk: %s @ %ld\n",
118bf76a35bc2e Eugen Hristev 2021-12-13  166  		__func__, best_rate,
118bf76a35bc2e Eugen Hristev 2021-12-13  167  		__clk_get_name((req->best_parent_hw)->clk),
118bf76a35bc2e Eugen Hristev 2021-12-13  168  		req->best_parent_rate);
118bf76a35bc2e Eugen Hristev 2021-12-13  169  
118bf76a35bc2e Eugen Hristev 2021-12-13  170  	if (best_rate < 0)
118bf76a35bc2e Eugen Hristev 2021-12-13  171  		return best_rate;
118bf76a35bc2e Eugen Hristev 2021-12-13  172  
118bf76a35bc2e Eugen Hristev 2021-12-13  173  	req->rate = best_rate;
118bf76a35bc2e Eugen Hristev 2021-12-13  174  
118bf76a35bc2e Eugen Hristev 2021-12-13  175  	return 0;
118bf76a35bc2e Eugen Hristev 2021-12-13  176  }
118bf76a35bc2e Eugen Hristev 2021-12-13  177  

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

^ permalink raw reply	[flat|nested] 5+ messages in thread

* drivers/media/platform/atmel/atmel-isc-clk.c:125:18: warning: Value stored to 'isc_clk' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
@ 2022-06-05  7:26 kernel test robot
  0 siblings, 0 replies; 5+ messages in thread
From: kernel test robot @ 2022-06-05  7:26 UTC (permalink / raw)
  To: kbuild

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

:::::: 
:::::: Manual check reason: "low confidence static check warning: drivers/media/platform/atmel/atmel-isc-clk.c:125:18: warning: Value stored to 'isc_clk' during its initialization is never read [clang-analyzer-deadcode.DeadStores]"
:::::: 

CC: llvm(a)lists.linux.dev
CC: kbuild-all(a)lists.01.org
BCC: lkp(a)intel.com
CC: linux-kernel(a)vger.kernel.org
TO: Eugen Hristev <eugen.hristev@microchip.com>
CC: Mauro Carvalho Chehab <mchehab@kernel.org>
CC: linux-media(a)vger.kernel.org
CC: Jacopo Mondi <jacopo+renesas@jmondi.org>
CC: Hans Verkuil <hverkuil@xs4all.nl>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   952923ddc01120190dcf671e7b354364ce1d1362
commit: 118bf76a35bc2ed061cd1454fe5e57d1c7bcd8d0 media: atmel: atmel-isc: split the clock code into separate source file
date:   4 months ago
:::::: branch date: 5 hours ago
:::::: commit date: 4 months ago
config: arm-randconfig-c002-20220605 (https://download.01.org/0day-ci/archive/20220605/202206051524.bvHWT74V-lkp(a)intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 0a90b72c432d70aae035727ece4ba80ce820f381)
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=118bf76a35bc2ed061cd1454fe5e57d1c7bcd8d0
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout 118bf76a35bc2ed061cd1454fe5e57d1c7bcd8d0
        # save the config file
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm clang-analyzer 

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@intel.com>


clang-analyzer warnings: (new ones prefixed by >>)
                               ^~~~~
   fs/xfs/libxfs/xfs_ialloc.c:1084:4: note: Taking false branch
                           if (error)
                           ^
   fs/xfs/libxfs/xfs_ialloc.c:1091:10: note: Left side of '&&' is true
                   while (--searchdistance > 0 && (!doneleft || !doneright)) {
                          ^
   fs/xfs/libxfs/xfs_ialloc.c:1091:36: note: 'doneleft' is 1
                   while (--searchdistance > 0 && (!doneleft || !doneright)) {
                                                    ^~~~~~~~
   fs/xfs/libxfs/xfs_ialloc.c:1091:35: note: Left side of '||' is false
                   while (--searchdistance > 0 && (!doneleft || !doneright)) {
                                                   ^
   fs/xfs/libxfs/xfs_ialloc.c:1091:48: note: Assuming 'doneright' is 0
                   while (--searchdistance > 0 && (!doneleft || !doneright)) {
                                                                ^~~~~~~~~~
   fs/xfs/libxfs/xfs_ialloc.c:1091:3: note: Loop condition is true.  Entering loop body
                   while (--searchdistance > 0 && (!doneleft || !doneright)) {
                   ^
   fs/xfs/libxfs/xfs_ialloc.c:1095:9: note: 'doneleft' is 1
                           if (!doneleft && !doneright) {
                                ^~~~~~~~
   fs/xfs/libxfs/xfs_ialloc.c:1095:18: note: Left side of '&&' is false
                           if (!doneleft && !doneright) {
                                         ^
   fs/xfs/libxfs/xfs_ialloc.c:1104:8: note: 'useleft' is 0
                           if (useleft && trec.ir_freecount) {
                               ^~~~~~~
   fs/xfs/libxfs/xfs_ialloc.c:1104:16: note: Left side of '&&' is false
                           if (useleft && trec.ir_freecount) {
                                       ^
   fs/xfs/libxfs/xfs_ialloc.c:1116:9: note: 'useleft' is 0
                           if (!useleft && rec.ir_freecount) {
                                ^~~~~~~
   fs/xfs/libxfs/xfs_ialloc.c:1116:8: note: Left side of '&&' is true
                           if (!useleft && rec.ir_freecount) {
                               ^
   fs/xfs/libxfs/xfs_ialloc.c:1116:20: note: Assuming field 'ir_freecount' is not equal to 0
                           if (!useleft && rec.ir_freecount) {
                                           ^~~~~~~~~~~~~~~~
   fs/xfs/libxfs/xfs_ialloc.c:1116:4: note: Taking true branch
                           if (!useleft && rec.ir_freecount) {
                           ^
   fs/xfs/libxfs/xfs_ialloc.c:1119:23: note: Assigned value is garbage or undefined
                                   pag->pagl_leftrec = trec.ir_startino;
                                                     ^ ~~~~~~~~~~~~~~~~
   fs/xfs/libxfs/xfs_ialloc.c:2669:33: warning: The left operand of '>' is a garbage value [clang-analyzer-core.UndefinedBinaryOperatorResult]
                   if (error || irec.ir_startino > high)
                                                 ^
   fs/xfs/libxfs/xfs_ialloc.c:2704:9: note: Calling 'xfs_ialloc_has_inode_record'
           return xfs_ialloc_has_inode_record(cur, low, high, exists);
                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/xfs/libxfs/xfs_ialloc.c:2666:10: note: Calling 'xfs_inobt_lookup'
           error = xfs_inobt_lookup(cur, low, XFS_LOOKUP_LE, &has_record);
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/xfs/libxfs/xfs_ialloc.c:46:9: note: Value assigned to 'has_record', which participates in a condition later
           return xfs_btree_lookup(cur, dir, stat);
                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/xfs/libxfs/xfs_ialloc.c:2666:10: note: Returning from 'xfs_inobt_lookup'
           error = xfs_inobt_lookup(cur, low, XFS_LOOKUP_LE, &has_record);
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/xfs/libxfs/xfs_ialloc.c:2667:9: note: Assuming 'error' is equal to 0
           while (error == 0 && has_record) {
                  ^~~~~~~~~~
   fs/xfs/libxfs/xfs_ialloc.c:2667:9: note: Left side of '&&' is true
   fs/xfs/libxfs/xfs_ialloc.c:2667:2: note: Loop condition is true.  Entering loop body
           while (error == 0 && has_record) {
           ^
   fs/xfs/libxfs/xfs_ialloc.c:2668:11: note: Calling 'xfs_inobt_get_rec'
                   error = xfs_inobt_get_rec(cur, &irec, &has_record);
                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/xfs/libxfs/xfs_ialloc.c:114:6: note: Assuming 'error' is 0, which participates in a condition later
           if (error || *stat == 0)
               ^~~~~
   fs/xfs/libxfs/xfs_ialloc.c:114:6: note: Left side of '||' is false
   fs/xfs/libxfs/xfs_ialloc.c:114:15: note: Assuming the condition is true
           if (error || *stat == 0)
                        ^~~~~~~~~~
   fs/xfs/libxfs/xfs_ialloc.c:114:2: note: Taking true branch
           if (error || *stat == 0)
           ^
   fs/xfs/libxfs/xfs_ialloc.c:115:3: note: Returning without writing to 'irec->ir_startino'
                   return error;
                   ^
   fs/xfs/libxfs/xfs_ialloc.c:115:3: note: Returning zero (loaded from 'error'), which participates in a condition later
                   return error;
                   ^~~~~~~~~~~~
   fs/xfs/libxfs/xfs_ialloc.c:2668:11: note: Returning from 'xfs_inobt_get_rec'
                   error = xfs_inobt_get_rec(cur, &irec, &has_record);
                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/xfs/libxfs/xfs_ialloc.c:2669:7: note: 'error' is 0
                   if (error || irec.ir_startino > high)
                       ^~~~~
   fs/xfs/libxfs/xfs_ialloc.c:2669:7: note: Left side of '||' is false
   fs/xfs/libxfs/xfs_ialloc.c:2669:33: note: The left operand of '>' is a garbage value
                   if (error || irec.ir_startino > high)
                                ~~~~~~~~~~~~~~~~ ^
   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/media/platform/atmel/atmel-isc-clk.c:125:18: warning: Value stored to 'isc_clk' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
           struct isc_clk *isc_clk = to_isc_clk(hw);
                           ^~~~~~~
   drivers/media/platform/atmel/atmel-isc-clk.c:125:18: note: Value stored to 'isc_clk' during its initialization is never read
           struct isc_clk *isc_clk = to_isc_clk(hw);
                           ^~~~~~~
   Suppressed 1 warnings (1 with check filters).
   1 warning generated.
   Suppressed 1 warnings (1 with check filters).
   1 warning generated.
   Suppressed 1 warnings (1 with check filters).
   1 warning generated.
   Suppressed 1 warnings (1 with check filters).
   1 warning generated.
   Suppressed 1 warnings (1 with check filters).
   3 warnings generated.
   drivers/media/usb/airspy/airspy.c:246:16: warning: Value stored to 'msecs' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
                   unsigned int msecs = jiffies_to_msecs(jiffies -
                                ^~~~~   ~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/media/usb/airspy/airspy.c:246:16: note: Value stored to 'msecs' during its initialization is never read
                   unsigned int msecs = jiffies_to_msecs(jiffies -
                                ^~~~~   ~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/media/usb/airspy/airspy.c:248:16: warning: Value stored to 'samples' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
                   unsigned int samples = s->sample - s->sample_measured;
                                ^~~~~~~   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/media/usb/airspy/airspy.c:248:16: note: Value stored to 'samples' during its initialization is never read
                   unsigned int samples = s->sample - s->sample_measured;
                                ^~~~~~~   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   Suppressed 1 warnings (1 with check filters).
   19 warnings generated.
   drivers/media/usb/hackrf/hackrf.c:237:24: warning: Value stored to 'intf' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
           struct usb_interface *intf = dev->intf;
                                 ^~~~   ~~~~~~~~~
   drivers/media/usb/hackrf/hackrf.c:237:24: note: Value stored to 'intf' during its initialization is never read
           struct usb_interface *intf = dev->intf;
                                 ^~~~   ~~~~~~~~~
   drivers/media/usb/hackrf/hackrf.c:462:16: warning: Value stored to 'msecs' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
                   unsigned int msecs = jiffies_to_msecs(jiffies -
                                ^~~~~   ~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/media/usb/hackrf/hackrf.c:462:16: note: Value stored to 'msecs' during its initialization is never read
                   unsigned int msecs = jiffies_to_msecs(jiffies -
                                ^~~~~   ~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/media/usb/hackrf/hackrf.c:464:16: warning: Value stored to 'samples' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
                   unsigned int samples = dev->sample - dev->sample_measured;
                                ^~~~~~~   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/media/usb/hackrf/hackrf.c:464:16: note: Value stored to 'samples' during its initialization is never read
                   unsigned int samples = dev->sample - dev->sample_measured;
                                ^~~~~~~   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/media/usb/hackrf/hackrf.c:730:24: warning: Value stored to 'intf' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
           struct usb_interface *intf = dev->intf;
                                 ^~~~   ~~~~~~~~~
   drivers/media/usb/hackrf/hackrf.c:730:24: note: Value stored to 'intf' during its initialization is never read
           struct usb_interface *intf = dev->intf;
                                 ^~~~   ~~~~~~~~~
   drivers/media/usb/hackrf/hackrf.c:793:24: warning: Value stored to 'intf' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
           struct usb_interface *intf = dev->intf;
                                 ^~~~   ~~~~~~~~~
   drivers/media/usb/hackrf/hackrf.c:793:24: note: Value stored to 'intf' during its initialization is never read
           struct usb_interface *intf = dev->intf;
                                 ^~~~   ~~~~~~~~~
   drivers/media/usb/hackrf/hackrf.c:862:24: warning: Value stored to 'intf' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
           struct usb_interface *intf = dev->intf;
                                 ^~~~   ~~~~~~~~~
   drivers/media/usb/hackrf/hackrf.c:862:24: note: Value stored to 'intf' during its initialization is never read
           struct usb_interface *intf = dev->intf;
                                 ^~~~   ~~~~~~~~~
   drivers/media/usb/hackrf/hackrf.c:898:24: warning: Value stored to 'intf' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
           struct usb_interface *intf = dev->intf;
                                 ^~~~   ~~~~~~~~~
   drivers/media/usb/hackrf/hackrf.c:898:24: note: Value stored to 'intf' during its initialization is never read
           struct usb_interface *intf = dev->intf;
                                 ^~~~   ~~~~~~~~~
   drivers/media/usb/hackrf/hackrf.c:966:21: warning: Value stored to 'dev' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
           struct hackrf_dev *dev = video_drvdata(file);
                              ^~~   ~~~~~~~~~~~~~~~~~~~
   drivers/media/usb/hackrf/hackrf.c:966:21: note: Value stored to 'dev' during its initialization is never read
           struct hackrf_dev *dev = video_drvdata(file);
                              ^~~   ~~~~~~~~~~~~~~~~~~~
   drivers/media/usb/hackrf/hackrf.c:988:21: warning: Value stored to 'dev' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
           struct hackrf_dev *dev = video_drvdata(file);
                              ^~~   ~~~~~~~~~~~~~~~~~~~
   drivers/media/usb/hackrf/hackrf.c:988:21: note: Value stored to 'dev' during its initialization is never read
           struct hackrf_dev *dev = video_drvdata(file);
                              ^~~   ~~~~~~~~~~~~~~~~~~~
   drivers/media/usb/hackrf/hackrf.c:1003:21: warning: Value stored to 'dev' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
           struct hackrf_dev *dev = video_drvdata(file);
                              ^~~   ~~~~~~~~~~~~~~~~~~~
   drivers/media/usb/hackrf/hackrf.c:1003:21: note: Value stored to 'dev' during its initialization is never read
           struct hackrf_dev *dev = video_drvdata(file);
                              ^~~   ~~~~~~~~~~~~~~~~~~~
   drivers/media/usb/hackrf/hackrf.c:1020:21: warning: Value stored to 'dev' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
           struct hackrf_dev *dev = video_drvdata(file);
                              ^~~   ~~~~~~~~~~~~~~~~~~~
   drivers/media/usb/hackrf/hackrf.c:1020:21: note: Value stored to 'dev' during its initialization is never read
           struct hackrf_dev *dev = video_drvdata(file);
                              ^~~   ~~~~~~~~~~~~~~~~~~~
   drivers/media/usb/hackrf/hackrf.c:1049:21: warning: Value stored to 'dev' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
           struct hackrf_dev *dev = video_drvdata(file);
                              ^~~   ~~~~~~~~~~~~~~~~~~~
   drivers/media/usb/hackrf/hackrf.c:1049:21: note: Value stored to 'dev' during its initialization is never read
           struct hackrf_dev *dev = video_drvdata(file);

vim +/isc_clk +125 drivers/media/platform/atmel/atmel-isc-clk.c

118bf76a35bc2e Eugen Hristev 2021-12-13  121  
118bf76a35bc2e Eugen Hristev 2021-12-13  122  static int isc_clk_determine_rate(struct clk_hw *hw,
118bf76a35bc2e Eugen Hristev 2021-12-13  123  				  struct clk_rate_request *req)
118bf76a35bc2e Eugen Hristev 2021-12-13  124  {
118bf76a35bc2e Eugen Hristev 2021-12-13 @125  	struct isc_clk *isc_clk = to_isc_clk(hw);
118bf76a35bc2e Eugen Hristev 2021-12-13  126  	long best_rate = -EINVAL;
118bf76a35bc2e Eugen Hristev 2021-12-13  127  	int best_diff = -1;
118bf76a35bc2e Eugen Hristev 2021-12-13  128  	unsigned int i, div;
118bf76a35bc2e Eugen Hristev 2021-12-13  129  
118bf76a35bc2e Eugen Hristev 2021-12-13  130  	for (i = 0; i < clk_hw_get_num_parents(hw); i++) {
118bf76a35bc2e Eugen Hristev 2021-12-13  131  		struct clk_hw *parent;
118bf76a35bc2e Eugen Hristev 2021-12-13  132  		unsigned long parent_rate;
118bf76a35bc2e Eugen Hristev 2021-12-13  133  
118bf76a35bc2e Eugen Hristev 2021-12-13  134  		parent = clk_hw_get_parent_by_index(hw, i);
118bf76a35bc2e Eugen Hristev 2021-12-13  135  		if (!parent)
118bf76a35bc2e Eugen Hristev 2021-12-13  136  			continue;
118bf76a35bc2e Eugen Hristev 2021-12-13  137  
118bf76a35bc2e Eugen Hristev 2021-12-13  138  		parent_rate = clk_hw_get_rate(parent);
118bf76a35bc2e Eugen Hristev 2021-12-13  139  		if (!parent_rate)
118bf76a35bc2e Eugen Hristev 2021-12-13  140  			continue;
118bf76a35bc2e Eugen Hristev 2021-12-13  141  
118bf76a35bc2e Eugen Hristev 2021-12-13  142  		for (div = 1; div < ISC_CLK_MAX_DIV + 2; div++) {
118bf76a35bc2e Eugen Hristev 2021-12-13  143  			unsigned long rate;
118bf76a35bc2e Eugen Hristev 2021-12-13  144  			int diff;
118bf76a35bc2e Eugen Hristev 2021-12-13  145  
118bf76a35bc2e Eugen Hristev 2021-12-13  146  			rate = DIV_ROUND_CLOSEST(parent_rate, div);
118bf76a35bc2e Eugen Hristev 2021-12-13  147  			diff = abs(req->rate - rate);
118bf76a35bc2e Eugen Hristev 2021-12-13  148  
118bf76a35bc2e Eugen Hristev 2021-12-13  149  			if (best_diff < 0 || best_diff > diff) {
118bf76a35bc2e Eugen Hristev 2021-12-13  150  				best_rate = rate;
118bf76a35bc2e Eugen Hristev 2021-12-13  151  				best_diff = diff;
118bf76a35bc2e Eugen Hristev 2021-12-13  152  				req->best_parent_rate = parent_rate;
118bf76a35bc2e Eugen Hristev 2021-12-13  153  				req->best_parent_hw = parent;
118bf76a35bc2e Eugen Hristev 2021-12-13  154  			}
118bf76a35bc2e Eugen Hristev 2021-12-13  155  
118bf76a35bc2e Eugen Hristev 2021-12-13  156  			if (!best_diff || rate < req->rate)
118bf76a35bc2e Eugen Hristev 2021-12-13  157  				break;
118bf76a35bc2e Eugen Hristev 2021-12-13  158  		}
118bf76a35bc2e Eugen Hristev 2021-12-13  159  
118bf76a35bc2e Eugen Hristev 2021-12-13  160  		if (!best_diff)
118bf76a35bc2e Eugen Hristev 2021-12-13  161  			break;
118bf76a35bc2e Eugen Hristev 2021-12-13  162  	}
118bf76a35bc2e Eugen Hristev 2021-12-13  163  
118bf76a35bc2e Eugen Hristev 2021-12-13  164  	dev_dbg(isc_clk->dev,
118bf76a35bc2e Eugen Hristev 2021-12-13  165  		"ISC CLK: %s, best_rate = %ld, parent clk: %s @ %ld\n",
118bf76a35bc2e Eugen Hristev 2021-12-13  166  		__func__, best_rate,
118bf76a35bc2e Eugen Hristev 2021-12-13  167  		__clk_get_name((req->best_parent_hw)->clk),
118bf76a35bc2e Eugen Hristev 2021-12-13  168  		req->best_parent_rate);
118bf76a35bc2e Eugen Hristev 2021-12-13  169  
118bf76a35bc2e Eugen Hristev 2021-12-13  170  	if (best_rate < 0)
118bf76a35bc2e Eugen Hristev 2021-12-13  171  		return best_rate;
118bf76a35bc2e Eugen Hristev 2021-12-13  172  
118bf76a35bc2e Eugen Hristev 2021-12-13  173  	req->rate = best_rate;
118bf76a35bc2e Eugen Hristev 2021-12-13  174  
118bf76a35bc2e Eugen Hristev 2021-12-13  175  	return 0;
118bf76a35bc2e Eugen Hristev 2021-12-13  176  }
118bf76a35bc2e Eugen Hristev 2021-12-13  177  

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

^ permalink raw reply	[flat|nested] 5+ messages in thread

* drivers/media/platform/atmel/atmel-isc-clk.c:125:18: warning: Value stored to 'isc_clk' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
@ 2022-05-02 10:04 kernel test robot
  0 siblings, 0 replies; 5+ messages in thread
From: kernel test robot @ 2022-05-02 10:04 UTC (permalink / raw)
  To: kbuild

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

CC: llvm(a)lists.linux.dev
CC: kbuild-all(a)lists.01.org
BCC: lkp(a)intel.com
CC: linux-kernel(a)vger.kernel.org
TO: Eugen Hristev <eugen.hristev@microchip.com>
CC: Mauro Carvalho Chehab <mchehab@kernel.org>
CC: linux-media(a)vger.kernel.org
CC: Jacopo Mondi <jacopo+renesas@jmondi.org>
CC: Hans Verkuil <hverkuil@xs4all.nl>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   672c0c5173427e6b3e2a9bbb7be51ceeec78093a
commit: 118bf76a35bc2ed061cd1454fe5e57d1c7bcd8d0 media: atmel: atmel-isc: split the clock code into separate source file
date:   3 months ago
:::::: branch date: 13 hours ago
:::::: commit date: 3 months ago
config: arm-randconfig-c002-20220427 (https://download.01.org/0day-ci/archive/20220502/202205021839.CChYnU0X-lkp(a)intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 1cddcfdc3c683b393df1a5c9063252eb60e52818)
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=118bf76a35bc2ed061cd1454fe5e57d1c7bcd8d0
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout 118bf76a35bc2ed061cd1454fe5e57d1c7bcd8d0
        # save the config file
        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 >>)
           if (ctlr->dma_rx) {
           ^
   drivers/spi/spi-bcm2835.c:1263:6: note: Assuming the condition is false
           if (spi->mode & SPI_NO_CS)
               ^~~~~~~~~~~~~~~~~~~~~
   drivers/spi/spi-bcm2835.c:1263:2: note: Taking false branch
           if (spi->mode & SPI_NO_CS)
           ^
   drivers/spi/spi-bcm2835.c:1269:6: note: Assuming field 'cs_gpiod' is null
           if (spi->cs_gpiod)
               ^~~~~~~~~~~~~
   drivers/spi/spi-bcm2835.c:1269:2: note: Taking false branch
           if (spi->cs_gpiod)
           ^
   drivers/spi/spi-bcm2835.c:1271:6: note: Assuming field 'chip_select' is <= 1
           if (spi->chip_select > 1) {
               ^~~~~~~~~~~~~~~~~~~~
   drivers/spi/spi-bcm2835.c:1271:2: note: Taking false branch
           if (spi->chip_select > 1) {
           ^
   drivers/spi/spi-bcm2835.c:1293:6: note: Assuming 'chip' is non-null
           if (!chip)
               ^~~~~
   drivers/spi/spi-bcm2835.c:1293:2: note: Taking false branch
           if (!chip)
           ^
   drivers/spi/spi-bcm2835.c:1300:2: note: Taking true branch
           if (IS_ERR(spi->cs_gpiod)) {
           ^
   drivers/spi/spi-bcm2835.c:1302:3: note: Control jumps to line 1312
                   goto err_cleanup;
                   ^
   drivers/spi/spi-bcm2835.c:1312:2: note: Calling 'bcm2835_spi_cleanup'
           bcm2835_spi_cleanup(spi);
           ^~~~~~~~~~~~~~~~~~~~~~~~
   drivers/spi/spi-bcm2835.c:1161:6: note: Assuming field 'clear_rx_desc' is null
           if (slv->clear_rx_desc)
               ^~~~~~~~~~~~~~~~~~
   drivers/spi/spi-bcm2835.c:1161:2: note: Taking false branch
           if (slv->clear_rx_desc)
           ^
   drivers/spi/spi-bcm2835.c:1164:6: note: Assuming field 'clear_rx_addr' is not equal to 0
           if (slv->clear_rx_addr)
               ^~~~~~~~~~~~~~~~~~
   drivers/spi/spi-bcm2835.c:1164:2: note: Taking true branch
           if (slv->clear_rx_addr)
           ^
   drivers/spi/spi-bcm2835.c:1165:20: note: Access to field 'device' results in a dereference of a null pointer (loaded from field 'dma_rx')
                   dma_unmap_single(ctlr->dma_rx->device->dev,
                                    ^
   include/linux/dma-mapping.h:407:61: note: expanded from macro 'dma_unmap_single'
   #define dma_unmap_single(d, a, s, r) dma_unmap_single_attrs(d, a, s, r, 0)
                                                               ^
   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 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.
   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).
   3 warnings generated.
   drivers/mfd/sm501.c:513:16: warning: Value stored to 'mode' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
           unsigned long mode = smc501_readl(sm->regs + SM501_POWER_MODE_CONTROL);
                         ^~~~
   drivers/mfd/sm501.c:513:16: note: Value stored to 'mode' during its initialization is never read
           unsigned long mode = smc501_readl(sm->regs + SM501_POWER_MODE_CONTROL);
                         ^~~~
   drivers/mfd/sm501.c:514:16: warning: Value stored to 'gate' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
           unsigned long gate = smc501_readl(sm->regs + SM501_CURRENT_GATE);
                         ^~~~
   drivers/mfd/sm501.c:514:16: note: Value stored to 'gate' during its initialization is never read
           unsigned long gate = smc501_readl(sm->regs + SM501_CURRENT_GATE);
                         ^~~~
   drivers/mfd/sm501.c:515:16: warning: Value stored to 'clock' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
           unsigned long clock = smc501_readl(sm->regs + SM501_CURRENT_CLOCK);
                         ^~~~~
   drivers/mfd/sm501.c:515:16: note: Value stored to 'clock' during its initialization is never read
           unsigned long clock = smc501_readl(sm->regs + SM501_CURRENT_CLOCK);
                         ^~~~~
   8 warnings generated.
   Suppressed 8 warnings (1 in non-user code, 7 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 with check filters).
   1 warning generated.
   Suppressed 1 warnings (1 with check filters).
   2 warnings generated.
>> drivers/media/platform/atmel/atmel-isc-clk.c:125:18: warning: Value stored to 'isc_clk' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
           struct isc_clk *isc_clk = to_isc_clk(hw);
                           ^~~~~~~
   drivers/media/platform/atmel/atmel-isc-clk.c:125:18: note: Value stored to 'isc_clk' during its initialization is never read
           struct isc_clk *isc_clk = to_isc_clk(hw);
                           ^~~~~~~
   Suppressed 1 warnings (1 with check filters).
   1 warning generated.
   Suppressed 1 warnings (1 with check filters).
   1 warning generated.
   Suppressed 1 warnings (1 with check filters).
   1 warning generated.
   Suppressed 1 warnings (1 with check filters).
   1 warning generated.
   Suppressed 1 warnings (1 with check filters).
   1 warning generated.
   Suppressed 1 warnings (1 with check filters).
   1 warning generated.
   Suppressed 1 warnings (1 with check filters).
   1 warning generated.
   fs/btrfs/free-space-cache.c:755:2: warning: Value stored to 'ret' is never read [clang-analyzer-deadcode.DeadStores]
           ret = -1;
           ^     ~~
   fs/btrfs/free-space-cache.c:755:2: note: Value stored to 'ret' is never read
           ret = -1;
           ^     ~~
   1 warning generated.
   fs/btrfs/zlib.c:227:13: warning: The left operand of '!=' is a garbage value [clang-analyzer-core.UndefinedBinaryOperatorResult]
           while (ret != Z_STREAM_END) {
                  ~~~ ^
   fs/btrfs/zlib.c:99:2: note: 'ret' declared without an initial value
           int ret;
           ^~~~~~~
   fs/btrfs/zlib.c:115:6: note: Assuming the condition is false
           if (Z_OK != zlib_deflateInit(&workspace->strm, workspace->level)) {
               ^
   include/linux/zlib.h:148:25: note: expanded from macro 'Z_OK'
   #define Z_OK            0
                           ^
   fs/btrfs/zlib.c:115:2: note: Taking false branch
           if (Z_OK != zlib_deflateInit(&workspace->strm, workspace->level)) {
           ^
   fs/btrfs/zlib.c:125:6: note: Assuming 'out_page' is not equal to NULL
           if (out_page == NULL) {
               ^~~~~~~~~~~~~~~~
   fs/btrfs/zlib.c:125:2: note: Taking false branch
           if (out_page == NULL) {
           ^
   fs/btrfs/zlib.c:138:9: note: Assuming 'len' is <= field 'total_in'
           while (workspace->strm.total_in < len) {
                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/btrfs/zlib.c:138:2: note: Loop condition is false. Execution continues on line 222
           while (workspace->strm.total_in < len) {
           ^
   fs/btrfs/zlib.c:227:13: note: The left operand of '!=' is a garbage value
           while (ret != Z_STREAM_END) {
                  ~~~ ^
   4 warnings generated.
   drivers/gpu/drm/tegra/dc.c:2283:2: warning: Value stored to 'value' is never read [clang-analyzer-deadcode.DeadStores]
           value = tegra_dc_readl(dc, DC_CMD_STATE_CONTROL);
           ^       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/tegra/dc.c:2283:2: note: Value stored to 'value' is never read
           value = tegra_dc_readl(dc, DC_CMD_STATE_CONTROL);
           ^       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/tegra/dc.c:2287:2: warning: Value stored to 'value' is never read [clang-analyzer-deadcode.DeadStores]
           value = tegra_dc_readl(dc, DC_CMD_STATE_CONTROL);
           ^       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/tegra/dc.c:2287:2: note: Value stored to 'value' is never read
           value = tegra_dc_readl(dc, DC_CMD_STATE_CONTROL);
           ^       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/tegra/dc.c:2376:2: warning: Value stored to 'old_state' is never read [clang-analyzer-deadcode.DeadStores]
           old_state = drm_atomic_get_old_crtc_state(state, crtc);
           ^           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/tegra/dc.c:2376:2: note: Value stored to 'old_state' is never read
           old_state = drm_atomic_get_old_crtc_state(state, crtc);
           ^           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   Suppressed 1 warnings (1 with check filters).
   1 warning generated.
   drivers/gpu/drm/tegra/sor.c:809:7: warning: Value stored to 'value' is never read [clang-analyzer-deadcode.DeadStores]
           for (value = 0, i = 0; i < link->lanes; i++) {
                ^       ~
   drivers/gpu/drm/tegra/sor.c:809:7: note: Value stored to 'value' is never read
           for (value = 0, i = 0; i < link->lanes; i++) {
                ^       ~
   1 warning generated.
   drivers/comedi/drivers/pcmmio.c:577:2: warning: Value stored to 'val' is never read [clang-analyzer-deadcode.DeadStores]
           val |= inb(iobase + PCMMIO_AI_MSB_REG) << 8;
           ^
   drivers/comedi/drivers/pcmmio.c:577:2: note: Value stored to 'val' is never read
   1 warning generated.
   drivers/iio/gyro/adis16080.c:43:8: warning: Excessive padding in 'struct adis16080_state' (42 padding bytes, where 10 is optimal). 
   Optimal fields order: 
   buf, 
   us, 
   info, 
   lock, 
   consider reordering the fields or adding explicit padding members [clang-analyzer-optin.performance.Padding]
   struct adis16080_state {
   ~~~~~~~^~~~~~~~~~~~~~~~~
   drivers/iio/gyro/adis16080.c:43:8: note: Excessive padding in 'struct adis16080_state' (42 padding bytes, where 10 is optimal). Optimal fields order: buf, us, info, lock, consider reordering the fields or adding explicit padding members
   struct adis16080_state {

vim +/isc_clk +125 drivers/media/platform/atmel/atmel-isc-clk.c

118bf76a35bc2e Eugen Hristev 2021-12-13  121  
118bf76a35bc2e Eugen Hristev 2021-12-13  122  static int isc_clk_determine_rate(struct clk_hw *hw,
118bf76a35bc2e Eugen Hristev 2021-12-13  123  				  struct clk_rate_request *req)
118bf76a35bc2e Eugen Hristev 2021-12-13  124  {
118bf76a35bc2e Eugen Hristev 2021-12-13 @125  	struct isc_clk *isc_clk = to_isc_clk(hw);
118bf76a35bc2e Eugen Hristev 2021-12-13  126  	long best_rate = -EINVAL;
118bf76a35bc2e Eugen Hristev 2021-12-13  127  	int best_diff = -1;
118bf76a35bc2e Eugen Hristev 2021-12-13  128  	unsigned int i, div;
118bf76a35bc2e Eugen Hristev 2021-12-13  129  
118bf76a35bc2e Eugen Hristev 2021-12-13  130  	for (i = 0; i < clk_hw_get_num_parents(hw); i++) {
118bf76a35bc2e Eugen Hristev 2021-12-13  131  		struct clk_hw *parent;
118bf76a35bc2e Eugen Hristev 2021-12-13  132  		unsigned long parent_rate;
118bf76a35bc2e Eugen Hristev 2021-12-13  133  
118bf76a35bc2e Eugen Hristev 2021-12-13  134  		parent = clk_hw_get_parent_by_index(hw, i);
118bf76a35bc2e Eugen Hristev 2021-12-13  135  		if (!parent)
118bf76a35bc2e Eugen Hristev 2021-12-13  136  			continue;
118bf76a35bc2e Eugen Hristev 2021-12-13  137  
118bf76a35bc2e Eugen Hristev 2021-12-13  138  		parent_rate = clk_hw_get_rate(parent);
118bf76a35bc2e Eugen Hristev 2021-12-13  139  		if (!parent_rate)
118bf76a35bc2e Eugen Hristev 2021-12-13  140  			continue;
118bf76a35bc2e Eugen Hristev 2021-12-13  141  
118bf76a35bc2e Eugen Hristev 2021-12-13  142  		for (div = 1; div < ISC_CLK_MAX_DIV + 2; div++) {
118bf76a35bc2e Eugen Hristev 2021-12-13  143  			unsigned long rate;
118bf76a35bc2e Eugen Hristev 2021-12-13  144  			int diff;
118bf76a35bc2e Eugen Hristev 2021-12-13  145  
118bf76a35bc2e Eugen Hristev 2021-12-13  146  			rate = DIV_ROUND_CLOSEST(parent_rate, div);
118bf76a35bc2e Eugen Hristev 2021-12-13  147  			diff = abs(req->rate - rate);
118bf76a35bc2e Eugen Hristev 2021-12-13  148  
118bf76a35bc2e Eugen Hristev 2021-12-13  149  			if (best_diff < 0 || best_diff > diff) {
118bf76a35bc2e Eugen Hristev 2021-12-13  150  				best_rate = rate;
118bf76a35bc2e Eugen Hristev 2021-12-13  151  				best_diff = diff;
118bf76a35bc2e Eugen Hristev 2021-12-13  152  				req->best_parent_rate = parent_rate;
118bf76a35bc2e Eugen Hristev 2021-12-13  153  				req->best_parent_hw = parent;
118bf76a35bc2e Eugen Hristev 2021-12-13  154  			}
118bf76a35bc2e Eugen Hristev 2021-12-13  155  
118bf76a35bc2e Eugen Hristev 2021-12-13  156  			if (!best_diff || rate < req->rate)
118bf76a35bc2e Eugen Hristev 2021-12-13  157  				break;
118bf76a35bc2e Eugen Hristev 2021-12-13  158  		}
118bf76a35bc2e Eugen Hristev 2021-12-13  159  
118bf76a35bc2e Eugen Hristev 2021-12-13  160  		if (!best_diff)
118bf76a35bc2e Eugen Hristev 2021-12-13  161  			break;
118bf76a35bc2e Eugen Hristev 2021-12-13  162  	}
118bf76a35bc2e Eugen Hristev 2021-12-13  163  
118bf76a35bc2e Eugen Hristev 2021-12-13  164  	dev_dbg(isc_clk->dev,
118bf76a35bc2e Eugen Hristev 2021-12-13  165  		"ISC CLK: %s, best_rate = %ld, parent clk: %s @ %ld\n",
118bf76a35bc2e Eugen Hristev 2021-12-13  166  		__func__, best_rate,
118bf76a35bc2e Eugen Hristev 2021-12-13  167  		__clk_get_name((req->best_parent_hw)->clk),
118bf76a35bc2e Eugen Hristev 2021-12-13  168  		req->best_parent_rate);
118bf76a35bc2e Eugen Hristev 2021-12-13  169  
118bf76a35bc2e Eugen Hristev 2021-12-13  170  	if (best_rate < 0)
118bf76a35bc2e Eugen Hristev 2021-12-13  171  		return best_rate;
118bf76a35bc2e Eugen Hristev 2021-12-13  172  
118bf76a35bc2e Eugen Hristev 2021-12-13  173  	req->rate = best_rate;
118bf76a35bc2e Eugen Hristev 2021-12-13  174  
118bf76a35bc2e Eugen Hristev 2021-12-13  175  	return 0;
118bf76a35bc2e Eugen Hristev 2021-12-13  176  }
118bf76a35bc2e Eugen Hristev 2021-12-13  177  

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

^ permalink raw reply	[flat|nested] 5+ messages in thread

* drivers/media/platform/atmel/atmel-isc-clk.c:125:18: warning: Value stored to 'isc_clk' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
@ 2022-04-30  3:50 kernel test robot
  0 siblings, 0 replies; 5+ messages in thread
From: kernel test robot @ 2022-04-30  3:50 UTC (permalink / raw)
  To: kbuild

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

CC: llvm(a)lists.linux.dev
CC: kbuild-all(a)lists.01.org
BCC: lkp(a)intel.com
CC: linux-kernel(a)vger.kernel.org
TO: Eugen Hristev <eugen.hristev@microchip.com>
CC: Mauro Carvalho Chehab <mchehab@kernel.org>
CC: linux-media(a)vger.kernel.org
CC: Jacopo Mondi <jacopo+renesas@jmondi.org>
CC: Hans Verkuil <hverkuil@xs4all.nl>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   8013d1d3d2e33236dee13a133fba49ad55045e79
commit: 118bf76a35bc2ed061cd1454fe5e57d1c7bcd8d0 media: atmel: atmel-isc: split the clock code into separate source file
date:   3 months ago
:::::: branch date: 5 hours ago
:::::: commit date: 3 months ago
config: arm-randconfig-c002-20220427 (https://download.01.org/0day-ci/archive/20220430/202204301105.B7JN1INB-lkp(a)intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 1cddcfdc3c683b393df1a5c9063252eb60e52818)
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=118bf76a35bc2ed061cd1454fe5e57d1c7bcd8d0
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout 118bf76a35bc2ed061cd1454fe5e57d1c7bcd8d0
        # save the config file
        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 >>)
           if (lpuart_is_32(sport))
           ^
   drivers/tty/serial/fsl_lpuart.c:2876:6: note: Assuming field 'lpuart_dma_rx_use' is true
           if (sport->lpuart_dma_rx_use) {
               ^~~~~~~~~~~~~~~~~~~~~~~~
   drivers/tty/serial/fsl_lpuart.c:2876:2: note: Taking true branch
           if (sport->lpuart_dma_rx_use) {
           ^
   drivers/tty/serial/fsl_lpuart.c:2877:7: note: Assuming 'irq_wake' is true
                   if (irq_wake) {
                       ^~~~~~~~
   drivers/tty/serial/fsl_lpuart.c:2877:3: note: Taking true branch
                   if (irq_wake) {
                   ^
   drivers/tty/serial/fsl_lpuart.c:2878:9: note: Calling 'lpuart_start_rx_dma'
                           if (!lpuart_start_rx_dma(sport))
                                ^~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/tty/serial/fsl_lpuart.c:1274:9: note: Assuming the condition is false
           bits = (termios->c_cflag & CSIZE) == CS7 ? 9 : 10;
                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/tty/serial/fsl_lpuart.c:1274:9: note: '?' condition is false
   drivers/tty/serial/fsl_lpuart.c:1275:6: note: Assuming the condition is false
           if (termios->c_cflag & PARENB)
               ^~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/tty/serial/fsl_lpuart.c:1275:2: note: Taking false branch
           if (termios->c_cflag & PARENB)
           ^
   drivers/tty/serial/fsl_lpuart.c:1283:33: note: The result of the left shift is undefined because the right operand is negative
           sport->rx_dma_rng_buf_len = (1 << (fls(sport->rx_dma_rng_buf_len) - 1));
                                          ^  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   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 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.
   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 with check filters).
   3 warnings generated.
   drivers/media/platform/rockchip/rkisp1/rkisp1-isp.c:479:2: warning: Value stored to 'cif_id' is never read [clang-analyzer-deadcode.DeadStores]
           cif_id = rkisp1_read(rkisp1, RKISP1_CIF_VI_ID);
           ^        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/media/platform/rockchip/rkisp1/rkisp1-isp.c:479:2: note: Value stored to 'cif_id' is never read
           cif_id = rkisp1_read(rkisp1, RKISP1_CIF_VI_ID);
           ^        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/media/platform/rockchip/rkisp1/rkisp1-isp.c:910:24: warning: Value stored to 'rkisp1' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
           struct rkisp1_device *rkisp1 =
                                 ^~~~~~
   drivers/media/platform/rockchip/rkisp1/rkisp1-isp.c:910:24: note: Value stored to 'rkisp1' during its initialization is never read
           struct rkisp1_device *rkisp1 =
                                 ^~~~~~
   Suppressed 1 warnings (1 with check filters).
   1 warning generated.
   Suppressed 1 warnings (1 with check filters).
   1 warning generated.
   Suppressed 1 warnings (1 with check filters).
   1 warning generated.
   Suppressed 1 warnings (1 with check filters).
   3 warnings generated.
   drivers/media/platform/am437x/am437x-vpfe.c:819:2: warning: Value stored to 'vpfe_int_status' is never read [clang-analyzer-deadcode.DeadStores]
           vpfe_int_status = vpfe_reg_read(ccdc, VPFE_IRQ_STS);
           ^                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/media/platform/am437x/am437x-vpfe.c:819:2: note: Value stored to 'vpfe_int_status' is never read
           vpfe_int_status = vpfe_reg_read(ccdc, VPFE_IRQ_STS);
           ^                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/media/platform/am437x/am437x-vpfe.c:1411:2: warning: Value stored to 'ret' is never read [clang-analyzer-deadcode.DeadStores]
           ret = 0;
           ^     ~
   drivers/media/platform/am437x/am437x-vpfe.c:1411:2: note: Value stored to 'ret' is never read
           ret = 0;
           ^     ~
   Suppressed 1 warnings (1 with check filters).
   1 warning generated.
   Suppressed 1 warnings (1 with check filters).
   1 warning generated.
   Suppressed 1 warnings (1 with check filters).
   1 warning generated.
   Suppressed 1 warnings (1 with check filters).
   1 warning generated.
   Suppressed 1 warnings (1 with check filters).
   1 warning generated.
   Suppressed 1 warnings (1 with check filters).
   2 warnings generated.
>> drivers/media/platform/atmel/atmel-isc-clk.c:125:18: warning: Value stored to 'isc_clk' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
           struct isc_clk *isc_clk = to_isc_clk(hw);
                           ^~~~~~~
   drivers/media/platform/atmel/atmel-isc-clk.c:125:18: note: Value stored to 'isc_clk' during its initialization is never read
           struct isc_clk *isc_clk = to_isc_clk(hw);
                           ^~~~~~~
   Suppressed 1 warnings (1 with check filters).
   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.
   7 warnings generated.
   Suppressed 7 warnings (7 with check filters).
   1 warning generated.
   drivers/mmc/core/core.c:1940:19: warning: Value stored to 'host' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
           struct mmc_host *host = card->host;
                            ^~~~   ~~~~~~~~~~
   drivers/mmc/core/core.c:1940:19: note: Value stored to 'host' during its initialization is never read
           struct mmc_host *host = card->host;
                            ^~~~   ~~~~~~~~~~
   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.
   drivers/iio/addac/ad74413r.c:51:8: warning: Excessive padding in 'struct ad74413r_state' (32 padding bytes, where 0 is optimal). 
   Optimal fields order: 
   adc_samples_buf, 
   num_gpo_gpios, 
   num_comparator_gpios, 
   sense_resistor_ohms, 
   chip_info, 
   spi, 
   refin_reg, 
   regmap, 
   dev, 
   trig, 
   adc_active_channels, 
   adc_data_completion, 
   lock, 
   gpo_gpio_offsets, 
   comp_gpio_offsets, 
   channel_configs, 
   adc_samples_msg, 
   gpo_gpiochip, 
   comp_gpiochip, 
   adc_samples_xfer, 
   reg_tx_buf, 
   reg_rx_buf, 
   adc_samples_tx_buf, 
   consider reordering the fields or adding explicit padding members [clang-analyzer-optin.performance.Padding]
   struct ad74413r_state {
   ~~~~~~~^~~~~~~~~~~~~~~~
   drivers/iio/addac/ad74413r.c:51:8: note: Excessive padding in 'struct ad74413r_state' (32 padding bytes, where 0 is optimal). Optimal fields order: adc_samples_buf, num_gpo_gpios, num_comparator_gpios, sense_resistor_ohms, chip_info, spi, refin_reg, regmap, dev, trig, adc_active_channels, adc_data_completion, lock, gpo_gpio_offsets, comp_gpio_offsets, channel_configs, adc_samples_msg, gpo_gpiochip, comp_gpiochip, adc_samples_xfer, reg_tx_buf, reg_rx_buf, adc_samples_tx_buf, consider reordering the fields or adding explicit padding members
   struct ad74413r_state {
   ~~~~~~~^~~~~~~~~~~~~~~~
   1 warning generated.
   drivers/gpu/drm/panel/panel-xinpeng-xpp055c272.c:74:17: warning: Value stored to 'dev' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
           struct device *dev = ctx->dev;
                          ^~~   ~~~~~~~~
   drivers/gpu/drm/panel/panel-xinpeng-xpp055c272.c:74:17: note: Value stored to 'dev' during its initialization is never read
           struct device *dev = ctx->dev;
                          ^~~   ~~~~~~~~
   1 warning generated.
   drivers/input/rmi4/rmi_f11.c:1129:2: warning: Value stored to 'query_offset' is never read [clang-analyzer-deadcode.DeadStores]
           query_offset += rc;
           ^               ~~
   drivers/input/rmi4/rmi_f11.c:1129:2: note: Value stored to 'query_offset' is never read
           query_offset += rc;
           ^               ~~
   3 warnings generated.
   drivers/input/rmi4/rmi_f12.c:133:3: warning: Value stored to 'offset' is never read [clang-analyzer-deadcode.DeadStores]
                   offset += 1;
                   ^         ~
   drivers/input/rmi4/rmi_f12.c:133:3: note: Value stored to 'offset' is never read
                   offset += 1;
                   ^         ~
   drivers/input/rmi4/rmi_f12.c:401:2: warning: Value stored to 'query_addr' is never read [clang-analyzer-deadcode.DeadStores]
           query_addr += 3;
           ^             ~
   drivers/input/rmi4/rmi_f12.c:401:2: note: Value stored to 'query_addr' is never read
           query_addr += 3;
           ^             ~
   drivers/input/rmi4/rmi_f12.c:520:3: warning: Value stored to 'data_offset' is never read [clang-analyzer-deadcode.DeadStores]
                   data_offset += item->reg_size;
                   ^              ~~~~~~~~~~~~~~
   drivers/input/rmi4/rmi_f12.c:520:3: note: Value stored to 'data_offset' is never read
                   data_offset += item->reg_size;
                   ^              ~~~~~~~~~~~~~~
   4 warnings generated.
   drivers/greybus/svc.c:1144:2: warning: Value stored to 'reset' is never read [clang-analyzer-deadcode.DeadStores]
           reset = request->payload;
           ^       ~~~~~~~~~~~~~~~~
   drivers/greybus/svc.c:1144:2: note: Value stored to 'reset' is never read
           reset = request->payload;
           ^       ~~~~~~~~~~~~~~~~
   drivers/greybus/svc.c:1162:2: warning: Value stored to 'request' is never read [clang-analyzer-deadcode.DeadStores]
           request = op->request->payload;
           ^         ~~~~~~~~~~~~~~~~~~~~
   drivers/greybus/svc.c:1162:2: note: Value stored to 'request' is never read
           request = op->request->payload;

vim +/isc_clk +125 drivers/media/platform/atmel/atmel-isc-clk.c

118bf76a35bc2ed Eugen Hristev 2021-12-13  121  
118bf76a35bc2ed Eugen Hristev 2021-12-13  122  static int isc_clk_determine_rate(struct clk_hw *hw,
118bf76a35bc2ed Eugen Hristev 2021-12-13  123  				  struct clk_rate_request *req)
118bf76a35bc2ed Eugen Hristev 2021-12-13  124  {
118bf76a35bc2ed Eugen Hristev 2021-12-13 @125  	struct isc_clk *isc_clk = to_isc_clk(hw);
118bf76a35bc2ed Eugen Hristev 2021-12-13  126  	long best_rate = -EINVAL;
118bf76a35bc2ed Eugen Hristev 2021-12-13  127  	int best_diff = -1;
118bf76a35bc2ed Eugen Hristev 2021-12-13  128  	unsigned int i, div;
118bf76a35bc2ed Eugen Hristev 2021-12-13  129  
118bf76a35bc2ed Eugen Hristev 2021-12-13  130  	for (i = 0; i < clk_hw_get_num_parents(hw); i++) {
118bf76a35bc2ed Eugen Hristev 2021-12-13  131  		struct clk_hw *parent;
118bf76a35bc2ed Eugen Hristev 2021-12-13  132  		unsigned long parent_rate;
118bf76a35bc2ed Eugen Hristev 2021-12-13  133  
118bf76a35bc2ed Eugen Hristev 2021-12-13  134  		parent = clk_hw_get_parent_by_index(hw, i);
118bf76a35bc2ed Eugen Hristev 2021-12-13  135  		if (!parent)
118bf76a35bc2ed Eugen Hristev 2021-12-13  136  			continue;
118bf76a35bc2ed Eugen Hristev 2021-12-13  137  
118bf76a35bc2ed Eugen Hristev 2021-12-13  138  		parent_rate = clk_hw_get_rate(parent);
118bf76a35bc2ed Eugen Hristev 2021-12-13  139  		if (!parent_rate)
118bf76a35bc2ed Eugen Hristev 2021-12-13  140  			continue;
118bf76a35bc2ed Eugen Hristev 2021-12-13  141  
118bf76a35bc2ed Eugen Hristev 2021-12-13  142  		for (div = 1; div < ISC_CLK_MAX_DIV + 2; div++) {
118bf76a35bc2ed Eugen Hristev 2021-12-13  143  			unsigned long rate;
118bf76a35bc2ed Eugen Hristev 2021-12-13  144  			int diff;
118bf76a35bc2ed Eugen Hristev 2021-12-13  145  
118bf76a35bc2ed Eugen Hristev 2021-12-13  146  			rate = DIV_ROUND_CLOSEST(parent_rate, div);
118bf76a35bc2ed Eugen Hristev 2021-12-13  147  			diff = abs(req->rate - rate);
118bf76a35bc2ed Eugen Hristev 2021-12-13  148  
118bf76a35bc2ed Eugen Hristev 2021-12-13  149  			if (best_diff < 0 || best_diff > diff) {
118bf76a35bc2ed Eugen Hristev 2021-12-13  150  				best_rate = rate;
118bf76a35bc2ed Eugen Hristev 2021-12-13  151  				best_diff = diff;
118bf76a35bc2ed Eugen Hristev 2021-12-13  152  				req->best_parent_rate = parent_rate;
118bf76a35bc2ed Eugen Hristev 2021-12-13  153  				req->best_parent_hw = parent;
118bf76a35bc2ed Eugen Hristev 2021-12-13  154  			}
118bf76a35bc2ed Eugen Hristev 2021-12-13  155  
118bf76a35bc2ed Eugen Hristev 2021-12-13  156  			if (!best_diff || rate < req->rate)
118bf76a35bc2ed Eugen Hristev 2021-12-13  157  				break;
118bf76a35bc2ed Eugen Hristev 2021-12-13  158  		}
118bf76a35bc2ed Eugen Hristev 2021-12-13  159  
118bf76a35bc2ed Eugen Hristev 2021-12-13  160  		if (!best_diff)
118bf76a35bc2ed Eugen Hristev 2021-12-13  161  			break;
118bf76a35bc2ed Eugen Hristev 2021-12-13  162  	}
118bf76a35bc2ed Eugen Hristev 2021-12-13  163  
118bf76a35bc2ed Eugen Hristev 2021-12-13  164  	dev_dbg(isc_clk->dev,
118bf76a35bc2ed Eugen Hristev 2021-12-13  165  		"ISC CLK: %s, best_rate = %ld, parent clk: %s @ %ld\n",
118bf76a35bc2ed Eugen Hristev 2021-12-13  166  		__func__, best_rate,
118bf76a35bc2ed Eugen Hristev 2021-12-13  167  		__clk_get_name((req->best_parent_hw)->clk),
118bf76a35bc2ed Eugen Hristev 2021-12-13  168  		req->best_parent_rate);
118bf76a35bc2ed Eugen Hristev 2021-12-13  169  
118bf76a35bc2ed Eugen Hristev 2021-12-13  170  	if (best_rate < 0)
118bf76a35bc2ed Eugen Hristev 2021-12-13  171  		return best_rate;
118bf76a35bc2ed Eugen Hristev 2021-12-13  172  
118bf76a35bc2ed Eugen Hristev 2021-12-13  173  	req->rate = best_rate;
118bf76a35bc2ed Eugen Hristev 2021-12-13  174  
118bf76a35bc2ed Eugen Hristev 2021-12-13  175  	return 0;
118bf76a35bc2ed Eugen Hristev 2021-12-13  176  }
118bf76a35bc2ed Eugen Hristev 2021-12-13  177  

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-06-06  2:41 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-07 12:51 drivers/media/platform/atmel/atmel-isc-clk.c:125:18: warning: Value stored to 'isc_clk' during its initialization is never read [clang-analyzer-deadcode.DeadStores] kernel test robot
2022-04-30  3:50 kernel test robot
2022-05-02 10:04 kernel test robot
2022-06-05  7:26 kernel test robot
2022-06-06  2:41 kernel test robot

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.