mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild@lists.01.org, Joseph CHAMG <josright123@gmail.com>
Cc: lkp@intel.com, kbuild-all@lists.01.org, linux-kernel@vger.kernel.org
Subject: drivers/net/ethernet/davicom/dm9051.c:610 dm9051_get_eeprom() error: uninitialized symbol 'ret'.
Date: Thu, 12 May 2022 13:18:17 +0300	[thread overview]
Message-ID: <202205121231.hPQrGSE5-lkp@intel.com> (raw)

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   feb9c5e19e913b53cb536a7aa7c9f20107bb51ec
commit: 2dc95a4d30eddac9679f295ba4304a7ab0e4ae02 net: Add dm9051 driver
config: csky-randconfig-m031-20220508 (https://download.01.org/0day-ci/archive/20220512/202205121231.hPQrGSE5-lkp@intel.com/config)
compiler: csky-linux-gcc (GCC) 11.3.0

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

New smatch warnings:
drivers/net/ethernet/davicom/dm9051.c:610 dm9051_get_eeprom() error: uninitialized symbol 'ret'.
drivers/net/ethernet/davicom/dm9051.c:632 dm9051_set_eeprom() error: uninitialized symbol 'ret'.

Old smatch warnings:
drivers/net/ethernet/davicom/dm9051.c:527 dm9051_map_chipid() warn: unsigned 'ret' is never less than zero.

vim +/ret +610 drivers/net/ethernet/davicom/dm9051.c

2dc95a4d30edda Joseph CHAMG 2022-02-11  592  static int dm9051_get_eeprom(struct net_device *ndev,
2dc95a4d30edda Joseph CHAMG 2022-02-11  593  			     struct ethtool_eeprom *ee, u8 *data)
2dc95a4d30edda Joseph CHAMG 2022-02-11  594  {
2dc95a4d30edda Joseph CHAMG 2022-02-11  595  	struct board_info *db = to_dm9051_board(ndev);
2dc95a4d30edda Joseph CHAMG 2022-02-11  596  	int offset = ee->offset;
2dc95a4d30edda Joseph CHAMG 2022-02-11  597  	int len = ee->len;
2dc95a4d30edda Joseph CHAMG 2022-02-11  598  	int i, ret;
2dc95a4d30edda Joseph CHAMG 2022-02-11  599  
2dc95a4d30edda Joseph CHAMG 2022-02-11  600  	if ((len | offset) & 1)

Can len be zero?  The kbuild-bot isn't doing cross function analysis so
it just assumes that it can be zero

2dc95a4d30edda Joseph CHAMG 2022-02-11  601  		return -EINVAL;
2dc95a4d30edda Joseph CHAMG 2022-02-11  602  
2dc95a4d30edda Joseph CHAMG 2022-02-11  603  	ee->magic = DM_EEPROM_MAGIC;
2dc95a4d30edda Joseph CHAMG 2022-02-11  604  
2dc95a4d30edda Joseph CHAMG 2022-02-11  605  	for (i = 0; i < len; i += 2) {
2dc95a4d30edda Joseph CHAMG 2022-02-11  606  		ret = dm9051_eeprom_read(db, (offset + i) / 2, data + i);
2dc95a4d30edda Joseph CHAMG 2022-02-11  607  		if (ret)
2dc95a4d30edda Joseph CHAMG 2022-02-11  608  			break;
2dc95a4d30edda Joseph CHAMG 2022-02-11  609  	}
2dc95a4d30edda Joseph CHAMG 2022-02-11 @610  	return ret;
2dc95a4d30edda Joseph CHAMG 2022-02-11  611  }
2dc95a4d30edda Joseph CHAMG 2022-02-11  612  
2dc95a4d30edda Joseph CHAMG 2022-02-11  613  static int dm9051_set_eeprom(struct net_device *ndev,
2dc95a4d30edda Joseph CHAMG 2022-02-11  614  			     struct ethtool_eeprom *ee, u8 *data)
2dc95a4d30edda Joseph CHAMG 2022-02-11  615  {
2dc95a4d30edda Joseph CHAMG 2022-02-11  616  	struct board_info *db = to_dm9051_board(ndev);
2dc95a4d30edda Joseph CHAMG 2022-02-11  617  	int offset = ee->offset;
2dc95a4d30edda Joseph CHAMG 2022-02-11  618  	int len = ee->len;
2dc95a4d30edda Joseph CHAMG 2022-02-11  619  	int i, ret;
2dc95a4d30edda Joseph CHAMG 2022-02-11  620  
2dc95a4d30edda Joseph CHAMG 2022-02-11  621  	if ((len | offset) & 1)
2dc95a4d30edda Joseph CHAMG 2022-02-11  622  		return -EINVAL;
2dc95a4d30edda Joseph CHAMG 2022-02-11  623  
2dc95a4d30edda Joseph CHAMG 2022-02-11  624  	if (ee->magic != DM_EEPROM_MAGIC)
2dc95a4d30edda Joseph CHAMG 2022-02-11  625  		return -EINVAL;
2dc95a4d30edda Joseph CHAMG 2022-02-11  626  
2dc95a4d30edda Joseph CHAMG 2022-02-11  627  	for (i = 0; i < len; i += 2) {
2dc95a4d30edda Joseph CHAMG 2022-02-11  628  		ret = dm9051_eeprom_write(db, (offset + i) / 2, data + i);
2dc95a4d30edda Joseph CHAMG 2022-02-11  629  		if (ret)
2dc95a4d30edda Joseph CHAMG 2022-02-11  630  			break;
2dc95a4d30edda Joseph CHAMG 2022-02-11  631  	}
2dc95a4d30edda Joseph CHAMG 2022-02-11 @632  	return ret;
2dc95a4d30edda Joseph CHAMG 2022-02-11  633  }

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


                 reply	other threads:[~2022-05-12 10:18 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=202205121231.hPQrGSE5-lkp@intel.com \
    --to=dan.carpenter@oracle.com \
    --cc=josright123@gmail.com \
    --cc=kbuild-all@lists.01.org \
    --cc=kbuild@lists.01.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@intel.com \
    /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®