All of lore.kernel.org
 help / color / mirror / Atom feed
* drivers/net/ethernet/micrel/ks8851_common.c:995:6: warning: variable 'ret' set but not used
@ 2021-06-02 19:32 kernel test robot
  2021-06-02 20:02 ` Nathan Chancellor
  0 siblings, 1 reply; 3+ messages in thread
From: kernel test robot @ 2021-06-02 19:32 UTC (permalink / raw)
  To: Marek Vasut; +Cc: kbuild-all, clang-built-linux, linux-kernel, Andrew Lunn

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

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   231bc539066760aaa44d46818c85b14ca2f56d9f
commit: 797047f875b5463719cc70ba213eb691d453c946 net: ks8851: Implement Parallel bus operations
date:   1 year ago
config: x86_64-randconfig-a004-20210601 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project d41cb6bb2607fa5c7a9df2b3dab361353657d225)
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 x86_64 cross compiling tool for clang build
        # apt-get install binutils-x86-64-linux-gnu
        # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=797047f875b5463719cc70ba213eb691d453c946
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout 797047f875b5463719cc70ba213eb691d453c946
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 

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/ethernet/micrel/ks8851_common.c:995:6: warning: variable 'ret' set but not used [-Wunused-but-set-variable]
           int ret = 0;
               ^
   1 warning generated.


vim +/ret +995 drivers/net/ethernet/micrel/ks8851_common.c

3ba81f3ece3cfa drivers/net/ks8851.c Ben Dooks   2009-07-16   985  
3ba81f3ece3cfa drivers/net/ks8851.c Ben Dooks   2009-07-16   986  /**
3ba81f3ece3cfa drivers/net/ks8851.c Ben Dooks   2009-07-16   987   * ks8851_read_selftest - read the selftest memory info.
3ba81f3ece3cfa drivers/net/ks8851.c Ben Dooks   2009-07-16   988   * @ks: The device state
3ba81f3ece3cfa drivers/net/ks8851.c Ben Dooks   2009-07-16   989   *
3ba81f3ece3cfa drivers/net/ks8851.c Ben Dooks   2009-07-16   990   * Read and check the TX/RX memory selftest information.
3ba81f3ece3cfa drivers/net/ks8851.c Ben Dooks   2009-07-16   991   */
3ba81f3ece3cfa drivers/net/ks8851.c Ben Dooks   2009-07-16   992  static int ks8851_read_selftest(struct ks8851_net *ks)
3ba81f3ece3cfa drivers/net/ks8851.c Ben Dooks   2009-07-16   993  {
3ba81f3ece3cfa drivers/net/ks8851.c Ben Dooks   2009-07-16   994  	unsigned both_done = MBIR_TXMBF | MBIR_RXMBF;
3ba81f3ece3cfa drivers/net/ks8851.c Ben Dooks   2009-07-16  @995  	int ret = 0;
3ba81f3ece3cfa drivers/net/ks8851.c Ben Dooks   2009-07-16   996  	unsigned rd;
3ba81f3ece3cfa drivers/net/ks8851.c Ben Dooks   2009-07-16   997  
3ba81f3ece3cfa drivers/net/ks8851.c Ben Dooks   2009-07-16   998  	rd = ks8851_rdreg16(ks, KS_MBIR);
3ba81f3ece3cfa drivers/net/ks8851.c Ben Dooks   2009-07-16   999  
3ba81f3ece3cfa drivers/net/ks8851.c Ben Dooks   2009-07-16  1000  	if ((rd & both_done) != both_done) {
0dc7d2b3cbfcf4 drivers/net/ks8851.c Joe Perches 2010-02-27  1001  		netdev_warn(ks->netdev, "Memory selftest not finished\n");
3ba81f3ece3cfa drivers/net/ks8851.c Ben Dooks   2009-07-16  1002  		return 0;
3ba81f3ece3cfa drivers/net/ks8851.c Ben Dooks   2009-07-16  1003  	}
3ba81f3ece3cfa drivers/net/ks8851.c Ben Dooks   2009-07-16  1004  
3ba81f3ece3cfa drivers/net/ks8851.c Ben Dooks   2009-07-16  1005  	if (rd & MBIR_TXMBFA) {
0dc7d2b3cbfcf4 drivers/net/ks8851.c Joe Perches 2010-02-27  1006  		netdev_err(ks->netdev, "TX memory selftest fail\n");
3ba81f3ece3cfa drivers/net/ks8851.c Ben Dooks   2009-07-16  1007  		ret |= 1;
3ba81f3ece3cfa drivers/net/ks8851.c Ben Dooks   2009-07-16  1008  	}
3ba81f3ece3cfa drivers/net/ks8851.c Ben Dooks   2009-07-16  1009  
3ba81f3ece3cfa drivers/net/ks8851.c Ben Dooks   2009-07-16  1010  	if (rd & MBIR_RXMBFA) {
0dc7d2b3cbfcf4 drivers/net/ks8851.c Joe Perches 2010-02-27  1011  		netdev_err(ks->netdev, "RX memory selftest fail\n");
3ba81f3ece3cfa drivers/net/ks8851.c Ben Dooks   2009-07-16  1012  		ret |= 2;
3ba81f3ece3cfa drivers/net/ks8851.c Ben Dooks   2009-07-16  1013  	}
3ba81f3ece3cfa drivers/net/ks8851.c Ben Dooks   2009-07-16  1014  
3ba81f3ece3cfa drivers/net/ks8851.c Ben Dooks   2009-07-16  1015  	return 0;
3ba81f3ece3cfa drivers/net/ks8851.c Ben Dooks   2009-07-16  1016  }
3ba81f3ece3cfa drivers/net/ks8851.c Ben Dooks   2009-07-16  1017  

:::::: The code at line 995 was first introduced by commit
:::::: 3ba81f3ece3cfa4ffb06d21ac93b8cad7fbe6a73 net: Micrel KS8851 SPI network driver

:::::: TO: Ben Dooks <ben@simtec.co.uk>
:::::: CC: David S. Miller <davem@davemloft.net>

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

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

* Re: drivers/net/ethernet/micrel/ks8851_common.c:995:6: warning: variable 'ret' set but not used
  2021-06-02 19:32 drivers/net/ethernet/micrel/ks8851_common.c:995:6: warning: variable 'ret' set but not used kernel test robot
@ 2021-06-02 20:02 ` Nathan Chancellor
  2021-06-02 23:29   ` Andrew Lunn
  0 siblings, 1 reply; 3+ messages in thread
From: Nathan Chancellor @ 2021-06-02 20:02 UTC (permalink / raw)
  To: kernel test robot, Marek Vasut
  Cc: kbuild-all, clang-built-linux, linux-kernel, Andrew Lunn

On 6/2/2021 12:32 PM, kernel test robot wrote:
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> head:   231bc539066760aaa44d46818c85b14ca2f56d9f
> commit: 797047f875b5463719cc70ba213eb691d453c946 net: ks8851: Implement Parallel bus operations
> date:   1 year ago
> config: x86_64-randconfig-a004-20210601 (attached as .config)
> compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project d41cb6bb2607fa5c7a9df2b3dab361353657d225)
> 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 x86_64 cross compiling tool for clang build
>          # apt-get install binutils-x86-64-linux-gnu
>          # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=797047f875b5463719cc70ba213eb691d453c946
>          git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
>          git fetch --no-tags linus master
>          git checkout 797047f875b5463719cc70ba213eb691d453c946
>          # save the attached .config to linux build tree
>          COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64
> 
> 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/ethernet/micrel/ks8851_common.c:995:6: warning: variable 'ret' set but not used [-Wunused-but-set-variable]
>             int ret = 0;
>                 ^
>     1 warning generated.

This warning is newly implemented in clang, it was not caused by the 
above commit. As you can see from the blame below, this has been an 
issue since this driver's introduction. I wonder if it was intended to 
return ret in the places that return 0?

Cheers,
Nathan

> vim +/ret +995 drivers/net/ethernet/micrel/ks8851_common.c
> 
> 3ba81f3ece3cfa drivers/net/ks8851.c Ben Dooks   2009-07-16   985
> 3ba81f3ece3cfa drivers/net/ks8851.c Ben Dooks   2009-07-16   986  /**
> 3ba81f3ece3cfa drivers/net/ks8851.c Ben Dooks   2009-07-16   987   * ks8851_read_selftest - read the selftest memory info.
> 3ba81f3ece3cfa drivers/net/ks8851.c Ben Dooks   2009-07-16   988   * @ks: The device state
> 3ba81f3ece3cfa drivers/net/ks8851.c Ben Dooks   2009-07-16   989   *
> 3ba81f3ece3cfa drivers/net/ks8851.c Ben Dooks   2009-07-16   990   * Read and check the TX/RX memory selftest information.
> 3ba81f3ece3cfa drivers/net/ks8851.c Ben Dooks   2009-07-16   991   */
> 3ba81f3ece3cfa drivers/net/ks8851.c Ben Dooks   2009-07-16   992  static int ks8851_read_selftest(struct ks8851_net *ks)
> 3ba81f3ece3cfa drivers/net/ks8851.c Ben Dooks   2009-07-16   993  {
> 3ba81f3ece3cfa drivers/net/ks8851.c Ben Dooks   2009-07-16   994  	unsigned both_done = MBIR_TXMBF | MBIR_RXMBF;
> 3ba81f3ece3cfa drivers/net/ks8851.c Ben Dooks   2009-07-16  @995  	int ret = 0;
> 3ba81f3ece3cfa drivers/net/ks8851.c Ben Dooks   2009-07-16   996  	unsigned rd;
> 3ba81f3ece3cfa drivers/net/ks8851.c Ben Dooks   2009-07-16   997
> 3ba81f3ece3cfa drivers/net/ks8851.c Ben Dooks   2009-07-16   998  	rd = ks8851_rdreg16(ks, KS_MBIR);
> 3ba81f3ece3cfa drivers/net/ks8851.c Ben Dooks   2009-07-16   999
> 3ba81f3ece3cfa drivers/net/ks8851.c Ben Dooks   2009-07-16  1000  	if ((rd & both_done) != both_done) {
> 0dc7d2b3cbfcf4 drivers/net/ks8851.c Joe Perches 2010-02-27  1001  		netdev_warn(ks->netdev, "Memory selftest not finished\n");
> 3ba81f3ece3cfa drivers/net/ks8851.c Ben Dooks   2009-07-16  1002  		return 0;
> 3ba81f3ece3cfa drivers/net/ks8851.c Ben Dooks   2009-07-16  1003  	}
> 3ba81f3ece3cfa drivers/net/ks8851.c Ben Dooks   2009-07-16  1004
> 3ba81f3ece3cfa drivers/net/ks8851.c Ben Dooks   2009-07-16  1005  	if (rd & MBIR_TXMBFA) {
> 0dc7d2b3cbfcf4 drivers/net/ks8851.c Joe Perches 2010-02-27  1006  		netdev_err(ks->netdev, "TX memory selftest fail\n");
> 3ba81f3ece3cfa drivers/net/ks8851.c Ben Dooks   2009-07-16  1007  		ret |= 1;
> 3ba81f3ece3cfa drivers/net/ks8851.c Ben Dooks   2009-07-16  1008  	}
> 3ba81f3ece3cfa drivers/net/ks8851.c Ben Dooks   2009-07-16  1009
> 3ba81f3ece3cfa drivers/net/ks8851.c Ben Dooks   2009-07-16  1010  	if (rd & MBIR_RXMBFA) {
> 0dc7d2b3cbfcf4 drivers/net/ks8851.c Joe Perches 2010-02-27  1011  		netdev_err(ks->netdev, "RX memory selftest fail\n");
> 3ba81f3ece3cfa drivers/net/ks8851.c Ben Dooks   2009-07-16  1012  		ret |= 2;
> 3ba81f3ece3cfa drivers/net/ks8851.c Ben Dooks   2009-07-16  1013  	}
> 3ba81f3ece3cfa drivers/net/ks8851.c Ben Dooks   2009-07-16  1014
> 3ba81f3ece3cfa drivers/net/ks8851.c Ben Dooks   2009-07-16  1015  	return 0;
> 3ba81f3ece3cfa drivers/net/ks8851.c Ben Dooks   2009-07-16  1016  }
> 3ba81f3ece3cfa drivers/net/ks8851.c Ben Dooks   2009-07-16  1017
> 
> :::::: The code at line 995 was first introduced by commit
> :::::: 3ba81f3ece3cfa4ffb06d21ac93b8cad7fbe6a73 net: Micrel KS8851 SPI network driver
> 
> :::::: TO: Ben Dooks <ben@simtec.co.uk>
> :::::: CC: David S. Miller <davem@davemloft.net>
> 
> ---
> 0-DAY CI Kernel Test Service, Intel Corporation
> https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
> 

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

* Re: drivers/net/ethernet/micrel/ks8851_common.c:995:6: warning: variable 'ret' set but not used
  2021-06-02 20:02 ` Nathan Chancellor
@ 2021-06-02 23:29   ` Andrew Lunn
  0 siblings, 0 replies; 3+ messages in thread
From: Andrew Lunn @ 2021-06-02 23:29 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: kernel test robot, Marek Vasut, kbuild-all, clang-built-linux,
	linux-kernel

On Wed, Jun 02, 2021 at 01:02:43PM -0700, Nathan Chancellor wrote:
> On 6/2/2021 12:32 PM, kernel test robot wrote:
> > tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> > head:   231bc539066760aaa44d46818c85b14ca2f56d9f
> > commit: 797047f875b5463719cc70ba213eb691d453c946 net: ks8851: Implement Parallel bus operations
> > date:   1 year ago
> > config: x86_64-randconfig-a004-20210601 (attached as .config)
> > compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project d41cb6bb2607fa5c7a9df2b3dab361353657d225)
> > 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 x86_64 cross compiling tool for clang build
> >          # apt-get install binutils-x86-64-linux-gnu
> >          # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=797047f875b5463719cc70ba213eb691d453c946
> >          git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
> >          git fetch --no-tags linus master
> >          git checkout 797047f875b5463719cc70ba213eb691d453c946
> >          # save the attached .config to linux build tree
> >          COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64
> > 
> > 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/ethernet/micrel/ks8851_common.c:995:6: warning: variable 'ret' set but not used [-Wunused-but-set-variable]
> >             int ret = 0;
> >                 ^
> >     1 warning generated.
> 
> This warning is newly implemented in clang, it was not caused by the above
> commit. As you can see from the blame below, this has been an issue since
> this driver's introduction. I wonder if it was intended to return ret in the
> places that return 0?

The return value from s8851_read_selftest() is ignored by the
caller. Probably ret could be removed and the function made to return
void.

	Andrew

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

end of thread, other threads:[~2021-06-02 23:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-02 19:32 drivers/net/ethernet/micrel/ks8851_common.c:995:6: warning: variable 'ret' set but not used kernel test robot
2021-06-02 20:02 ` Nathan Chancellor
2021-06-02 23:29   ` Andrew Lunn

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.