Building the Linux kernel with Clang and LLVM
 help / color / mirror / Atom feed
* [phy:next 32/34] drivers/phy/rockchip/phy-rockchip-usbdp.c:1292:6: warning: variable 'ret' is used uninitialized whenever 'if' condition is true
@ 2024-04-14  2:31 kernel test robot
  2024-04-14 16:05 ` Sebastian Reichel
  0 siblings, 1 reply; 4+ messages in thread
From: kernel test robot @ 2024-04-14  2:31 UTC (permalink / raw)
  To: Sebastian Reichel
  Cc: llvm, oe-kbuild-all, Vinod Koul, Kishon, Heiko Stuebner,
	Zhang Yubing, Frank Wang

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/phy/linux-phy.git next
head:   a1fe1eca0d8be69ccc1f3d615e5a529df1c82e66
commit: 2f70bbddeb457580cef3ceb574506083b9272188 [32/34] phy: rockchip: add usbdp combo phy driver
config: arm64-allmodconfig (https://download.01.org/0day-ci/archive/20240414/202404141048.qFAYDctQ-lkp@intel.com/config)
compiler: clang version 19.0.0git (https://github.com/llvm/llvm-project 8b3b4a92adee40483c27f26c478a384cd69c6f05)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240414/202404141048.qFAYDctQ-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202404141048.qFAYDctQ-lkp@intel.com/

All warnings (new ones prefixed by >>):

   In file included from drivers/phy/rockchip/phy-rockchip-usbdp.c:19:
   In file included from include/linux/phy/phy.h:17:
   In file included from include/linux/regulator/consumer.h:35:
   In file included from include/linux/suspend.h:5:
   In file included from include/linux/swap.h:9:
   In file included from include/linux/memcontrol.h:21:
   In file included from include/linux/mm.h:2208:
   include/linux/vmstat.h:508:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
     508 |         return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~ ^
     509 |                            item];
         |                            ~~~~
   include/linux/vmstat.h:515:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
     515 |         return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~ ^
     516 |                            NR_VM_NUMA_EVENT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~~
   include/linux/vmstat.h:522:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
     522 |         return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
         |                               ~~~~~~~~~~~ ^ ~~~
   include/linux/vmstat.h:527:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
     527 |         return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~ ^
     528 |                            NR_VM_NUMA_EVENT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~~
   include/linux/vmstat.h:536:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
     536 |         return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~ ^
     537 |                            NR_VM_NUMA_EVENT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~~
>> drivers/phy/rockchip/phy-rockchip-usbdp.c:1292:6: warning: variable 'ret' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
    1292 |         if (!(udphy->mode & UDPHY_MODE_USB) || udphy->hs) {
         |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/phy/rockchip/phy-rockchip-usbdp.c:1301:9: note: uninitialized use occurs here
    1301 |         return ret;
         |                ^~~
   drivers/phy/rockchip/phy-rockchip-usbdp.c:1292:2: note: remove the 'if' if its condition is always false
    1292 |         if (!(udphy->mode & UDPHY_MODE_USB) || udphy->hs) {
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    1293 |                 rk_udphy_u3_port_disable(udphy, true);
         |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    1294 |                 goto unlock;
         |                 ~~~~~~~~~~~~
    1295 |         }
         |         ~
>> drivers/phy/rockchip/phy-rockchip-usbdp.c:1292:6: warning: variable 'ret' is used uninitialized whenever '||' condition is true [-Wsometimes-uninitialized]
    1292 |         if (!(udphy->mode & UDPHY_MODE_USB) || udphy->hs) {
         |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/phy/rockchip/phy-rockchip-usbdp.c:1301:9: note: uninitialized use occurs here
    1301 |         return ret;
         |                ^~~
   drivers/phy/rockchip/phy-rockchip-usbdp.c:1292:6: note: remove the '||' if its condition is always false
    1292 |         if (!(udphy->mode & UDPHY_MODE_USB) || udphy->hs) {
         |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/phy/rockchip/phy-rockchip-usbdp.c:1288:9: note: initialize the variable 'ret' to silence this warning
    1288 |         int ret;
         |                ^
         |                 = 0
   7 warnings generated.


vim +1292 drivers/phy/rockchip/phy-rockchip-usbdp.c

  1284	
  1285	static int rk_udphy_usb3_phy_init(struct phy *phy)
  1286	{
  1287		struct rk_udphy *udphy = phy_get_drvdata(phy);
  1288		int ret;
  1289	
  1290		mutex_lock(&udphy->mutex);
  1291		/* DP only or high-speed, disable U3 port */
> 1292		if (!(udphy->mode & UDPHY_MODE_USB) || udphy->hs) {
  1293			rk_udphy_u3_port_disable(udphy, true);
  1294			goto unlock;
  1295		}
  1296	
  1297		ret = rk_udphy_power_on(udphy, UDPHY_MODE_USB);
  1298	
  1299	unlock:
  1300		mutex_unlock(&udphy->mutex);
  1301		return ret;
  1302	}
  1303	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

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

end of thread, other threads:[~2024-04-15  9:02 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-14  2:31 [phy:next 32/34] drivers/phy/rockchip/phy-rockchip-usbdp.c:1292:6: warning: variable 'ret' is used uninitialized whenever 'if' condition is true kernel test robot
2024-04-14 16:05 ` Sebastian Reichel
2024-04-15  7:35   ` Vinod Koul
2024-04-15  9:02     ` Sebastian Reichel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox