All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: kbuild-all@lists.01.org
Subject: [net-next:master 89/100] drivers/net/phy/motorcomm.c:58:6: warning: variable 'ret' is used uninitialized whenever 'if' condition is true
Date: Sat, 22 May 2021 23:48:48 +0800	[thread overview]
Message-ID: <202105222341.5uvNQSLS-lkp@intel.com> (raw)

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

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git master
head:   f5120f5998803a973b1d432ed2aa7e592527aa46
commit: 48e8c6f1612b3d2dccaea2285231def830cc5b8e [89/100] net: phy: add driver for Motorcomm yt8511 phy
config: arm-randconfig-r033-20210522 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project e84a9b9bb3051c35dea993cdad7b3d2575638f85)
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/davem/net-next.git/commit/?id=48e8c6f1612b3d2dccaea2285231def830cc5b8e
        git remote add net-next https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git
        git fetch --no-tags net-next master
        git checkout 48e8c6f1612b3d2dccaea2285231def830cc5b8e
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm 

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

All warnings (new ones prefixed by >>):

>> drivers/net/phy/motorcomm.c:58:6: warning: variable 'ret' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
           if (oldpage < 0)
               ^~~~~~~~~~~
   drivers/net/phy/motorcomm.c:110:43: note: uninitialized use occurs here
           return phy_restore_page(phydev, oldpage, ret);
                                                    ^~~
   drivers/net/phy/motorcomm.c:58:2: note: remove the 'if' if its condition is always false
           if (oldpage < 0)
           ^~~~~~~~~~~~~~~~
   drivers/net/phy/motorcomm.c:54:9: note: initialize the variable 'ret' to silence this warning
           int ret, oldpage;
                  ^
                   = 0
>> drivers/net/phy/motorcomm.c:83:2: warning: variable 'ge' is used uninitialized whenever switch default is taken [-Wsometimes-uninitialized]
           default: /* leave everything alone in other modes */
           ^~~~~~~
   drivers/net/phy/motorcomm.c:87:85: note: uninitialized use occurs here
           ret = __phy_modify(phydev, YT8511_PAGE, (YT8511_DELAY_RX | YT8511_DELAY_GE_TX_EN), ge);
                                                                                              ^~
   drivers/net/phy/motorcomm.c:53:17: note: initialize the variable 'ge' to silence this warning
           unsigned int ge, fe;
                          ^
                           = 0
   2 warnings generated.


vim +58 drivers/net/phy/motorcomm.c

    50	
    51	static int yt8511_config_init(struct phy_device *phydev)
    52	{
    53		unsigned int ge, fe;
    54		int ret, oldpage;
    55	
    56		/* set clock mode to 125mhz */
    57		oldpage = phy_select_page(phydev, YT8511_EXT_CLK_GATE);
  > 58		if (oldpage < 0)
    59			goto err_restore_page;
    60	
    61		ret = __phy_modify(phydev, YT8511_PAGE, 0, YT8511_CLK_125M);
    62		if (ret < 0)
    63			goto err_restore_page;
    64	
    65		/* set rgmii delay mode */
    66		switch (phydev->interface) {
    67		case PHY_INTERFACE_MODE_RGMII:
    68			ge = YT8511_DELAY_GE_TX_DIS;
    69			fe = YT8511_DELAY_FE_TX_DIS;
    70			break;
    71		case PHY_INTERFACE_MODE_RGMII_RXID:
    72			ge = YT8511_DELAY_RX | YT8511_DELAY_GE_TX_DIS;
    73			fe = YT8511_DELAY_FE_TX_DIS;
    74			break;
    75		case PHY_INTERFACE_MODE_RGMII_TXID:
    76			ge = YT8511_DELAY_GE_TX_EN;
    77			fe = YT8511_DELAY_FE_TX_EN;
    78			break;
    79		case PHY_INTERFACE_MODE_RGMII_ID:
    80			ge = YT8511_DELAY_RX | YT8511_DELAY_GE_TX_EN;
    81			fe = YT8511_DELAY_FE_TX_EN;
    82			break;
  > 83		default: /* leave everything alone in other modes */
    84			break;
    85		}
    86	
    87		ret = __phy_modify(phydev, YT8511_PAGE, (YT8511_DELAY_RX | YT8511_DELAY_GE_TX_EN), ge);
    88		if (ret < 0)
    89			goto err_restore_page;
    90	
    91		/* fast ethernet delay is in a separate page */
    92		ret = __phy_write(phydev, YT8511_PAGE_SELECT, YT8511_EXT_DELAY_DRIVE);
    93		if (ret < 0)
    94			goto err_restore_page;
    95	
    96		ret = __phy_modify(phydev, YT8511_PAGE, YT8511_DELAY_FE_TX_EN, fe);
    97		if (ret < 0)
    98			goto err_restore_page;
    99	
   100		/* leave pll enabled in sleep */
   101		ret = __phy_write(phydev, YT8511_PAGE_SELECT, YT8511_EXT_SLEEP_CTRL);
   102		if (ret < 0)
   103			goto err_restore_page;
   104	
   105		ret = __phy_modify(phydev, YT8511_PAGE, 0, YT8511_PLLON_SLP);
   106		if (ret < 0)
   107			goto err_restore_page;
   108	
   109	err_restore_page:
   110		return phy_restore_page(phydev, oldpage, ret);
   111	}
   112	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 24578 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: kernel test robot <lkp@intel.com>
To: Peter Geis <pgwipeout@gmail.com>
Cc: kbuild-all@lists.01.org, clang-built-linux@googlegroups.com,
	netdev@vger.kernel.org
Subject: [net-next:master 89/100] drivers/net/phy/motorcomm.c:58:6: warning: variable 'ret' is used uninitialized whenever 'if' condition is true
Date: Sat, 22 May 2021 23:48:48 +0800	[thread overview]
Message-ID: <202105222341.5uvNQSLS-lkp@intel.com> (raw)

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

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git master
head:   f5120f5998803a973b1d432ed2aa7e592527aa46
commit: 48e8c6f1612b3d2dccaea2285231def830cc5b8e [89/100] net: phy: add driver for Motorcomm yt8511 phy
config: arm-randconfig-r033-20210522 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project e84a9b9bb3051c35dea993cdad7b3d2575638f85)
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/davem/net-next.git/commit/?id=48e8c6f1612b3d2dccaea2285231def830cc5b8e
        git remote add net-next https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git
        git fetch --no-tags net-next master
        git checkout 48e8c6f1612b3d2dccaea2285231def830cc5b8e
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm 

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

All warnings (new ones prefixed by >>):

>> drivers/net/phy/motorcomm.c:58:6: warning: variable 'ret' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
           if (oldpage < 0)
               ^~~~~~~~~~~
   drivers/net/phy/motorcomm.c:110:43: note: uninitialized use occurs here
           return phy_restore_page(phydev, oldpage, ret);
                                                    ^~~
   drivers/net/phy/motorcomm.c:58:2: note: remove the 'if' if its condition is always false
           if (oldpage < 0)
           ^~~~~~~~~~~~~~~~
   drivers/net/phy/motorcomm.c:54:9: note: initialize the variable 'ret' to silence this warning
           int ret, oldpage;
                  ^
                   = 0
>> drivers/net/phy/motorcomm.c:83:2: warning: variable 'ge' is used uninitialized whenever switch default is taken [-Wsometimes-uninitialized]
           default: /* leave everything alone in other modes */
           ^~~~~~~
   drivers/net/phy/motorcomm.c:87:85: note: uninitialized use occurs here
           ret = __phy_modify(phydev, YT8511_PAGE, (YT8511_DELAY_RX | YT8511_DELAY_GE_TX_EN), ge);
                                                                                              ^~
   drivers/net/phy/motorcomm.c:53:17: note: initialize the variable 'ge' to silence this warning
           unsigned int ge, fe;
                          ^
                           = 0
   2 warnings generated.


vim +58 drivers/net/phy/motorcomm.c

    50	
    51	static int yt8511_config_init(struct phy_device *phydev)
    52	{
    53		unsigned int ge, fe;
    54		int ret, oldpage;
    55	
    56		/* set clock mode to 125mhz */
    57		oldpage = phy_select_page(phydev, YT8511_EXT_CLK_GATE);
  > 58		if (oldpage < 0)
    59			goto err_restore_page;
    60	
    61		ret = __phy_modify(phydev, YT8511_PAGE, 0, YT8511_CLK_125M);
    62		if (ret < 0)
    63			goto err_restore_page;
    64	
    65		/* set rgmii delay mode */
    66		switch (phydev->interface) {
    67		case PHY_INTERFACE_MODE_RGMII:
    68			ge = YT8511_DELAY_GE_TX_DIS;
    69			fe = YT8511_DELAY_FE_TX_DIS;
    70			break;
    71		case PHY_INTERFACE_MODE_RGMII_RXID:
    72			ge = YT8511_DELAY_RX | YT8511_DELAY_GE_TX_DIS;
    73			fe = YT8511_DELAY_FE_TX_DIS;
    74			break;
    75		case PHY_INTERFACE_MODE_RGMII_TXID:
    76			ge = YT8511_DELAY_GE_TX_EN;
    77			fe = YT8511_DELAY_FE_TX_EN;
    78			break;
    79		case PHY_INTERFACE_MODE_RGMII_ID:
    80			ge = YT8511_DELAY_RX | YT8511_DELAY_GE_TX_EN;
    81			fe = YT8511_DELAY_FE_TX_EN;
    82			break;
  > 83		default: /* leave everything alone in other modes */
    84			break;
    85		}
    86	
    87		ret = __phy_modify(phydev, YT8511_PAGE, (YT8511_DELAY_RX | YT8511_DELAY_GE_TX_EN), ge);
    88		if (ret < 0)
    89			goto err_restore_page;
    90	
    91		/* fast ethernet delay is in a separate page */
    92		ret = __phy_write(phydev, YT8511_PAGE_SELECT, YT8511_EXT_DELAY_DRIVE);
    93		if (ret < 0)
    94			goto err_restore_page;
    95	
    96		ret = __phy_modify(phydev, YT8511_PAGE, YT8511_DELAY_FE_TX_EN, fe);
    97		if (ret < 0)
    98			goto err_restore_page;
    99	
   100		/* leave pll enabled in sleep */
   101		ret = __phy_write(phydev, YT8511_PAGE_SELECT, YT8511_EXT_SLEEP_CTRL);
   102		if (ret < 0)
   103			goto err_restore_page;
   104	
   105		ret = __phy_modify(phydev, YT8511_PAGE, 0, YT8511_PLLON_SLP);
   106		if (ret < 0)
   107			goto err_restore_page;
   108	
   109	err_restore_page:
   110		return phy_restore_page(phydev, oldpage, ret);
   111	}
   112	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 24578 bytes --]

             reply	other threads:[~2021-05-22 15:48 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-22 15:48 kernel test robot [this message]
2021-05-22 15:48 ` [net-next:master 89/100] drivers/net/phy/motorcomm.c:58:6: warning: variable 'ret' is used uninitialized whenever 'if' condition is true kernel test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202105222341.5uvNQSLS-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=kbuild-all@lists.01.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.