mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Nathan Chancellor <nathan@kernel.org>
To: kernel test robot <lkp@intel.com>, Marek Vasut <marex@denx.de>
Cc: kbuild-all@lists.01.org, clang-built-linux@googlegroups.com,
	linux-kernel@vger.kernel.org, Andrew Lunn <andrew@lunn.ch>
Subject: Re: drivers/net/ethernet/micrel/ks8851_common.c:995:6: warning: variable 'ret' set but not used
Date: Wed, 2 Jun 2021 13:02:43 -0700	[thread overview]
Message-ID: <b34e07af-4559-7707-b00b-5a36789e566d@kernel.org> (raw)
In-Reply-To: <202106030332.tmiMOCF7-lkp@intel.com>

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
> 

  reply	other threads:[~2021-06-02 20:02 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-02 19:32 kernel test robot
2021-06-02 20:02 ` Nathan Chancellor [this message]
2021-06-02 23:29   ` Andrew Lunn

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=b34e07af-4559-7707-b00b-5a36789e566d@kernel.org \
    --to=nathan@kernel.org \
    --cc=andrew@lunn.ch \
    --cc=clang-built-linux@googlegroups.com \
    --cc=kbuild-all@lists.01.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=marex@denx.de \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®