Re: [PATCH] net: ax88179: add proper error handling of usb read errors

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi David,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on net/master]
[also build test WARNING on net-next/master horms-ipvs/master linus/master v5.18-rc1 next-20220405]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/intel-lab-lkp/linux/commits/David-Kahurani/net-ax88179-add-proper-error-handling-of-usb-read-errors/20220404-231226
base:   https://git.kernel.org/pub/scm/linux/kernel/git/davem/net.git 692930cc435099580a4b9e32fa781b0688c18439
config: i386-randconfig-m021-20220404 (https://download.01.org/0day-ci/archive/20220406/202204060410.mWlznHB9-lkp@xxxxxxxxx/config)
compiler: gcc-11 (Debian 11.2.0-19) 11.2.0

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

smatch warnings:
drivers/net/usb/ax88179_178a.c:1164 ax88179_check_eeprom() warn: inconsistent indenting

vim +1164 drivers/net/usb/ax88179_178a.c

e2ca90c276e1fc4 Freddy Xin     2013-03-02  1132  
e2ca90c276e1fc4 Freddy Xin     2013-03-02  1133  static int ax88179_check_eeprom(struct usbnet *dev)
e2ca90c276e1fc4 Freddy Xin     2013-03-02  1134  {
e2ca90c276e1fc4 Freddy Xin     2013-03-02  1135  	u8 i, buf, eeprom[20];
e2ca90c276e1fc4 Freddy Xin     2013-03-02  1136  	u16 csum, delay = HZ / 10;
e2ca90c276e1fc4 Freddy Xin     2013-03-02  1137  	unsigned long jtimeout;
c006257c3aa36f6 David Kahurani 2022-04-04  1138  	int ret;
e2ca90c276e1fc4 Freddy Xin     2013-03-02  1139  
e2ca90c276e1fc4 Freddy Xin     2013-03-02  1140  	/* Read EEPROM content */
e2ca90c276e1fc4 Freddy Xin     2013-03-02  1141  	for (i = 0; i < 6; i++) {
e2ca90c276e1fc4 Freddy Xin     2013-03-02  1142  		buf = i;
e2ca90c276e1fc4 Freddy Xin     2013-03-02  1143  		if (ax88179_write_cmd(dev, AX_ACCESS_MAC, AX_SROM_ADDR,
e2ca90c276e1fc4 Freddy Xin     2013-03-02  1144  				      1, 1, &buf) < 0)
e2ca90c276e1fc4 Freddy Xin     2013-03-02  1145  			return -EINVAL;
e2ca90c276e1fc4 Freddy Xin     2013-03-02  1146  
e2ca90c276e1fc4 Freddy Xin     2013-03-02  1147  		buf = EEP_RD;
e2ca90c276e1fc4 Freddy Xin     2013-03-02  1148  		if (ax88179_write_cmd(dev, AX_ACCESS_MAC, AX_SROM_CMD,
e2ca90c276e1fc4 Freddy Xin     2013-03-02  1149  				      1, 1, &buf) < 0)
e2ca90c276e1fc4 Freddy Xin     2013-03-02  1150  			return -EINVAL;
e2ca90c276e1fc4 Freddy Xin     2013-03-02  1151  
e2ca90c276e1fc4 Freddy Xin     2013-03-02  1152  		jtimeout = jiffies + delay;
e2ca90c276e1fc4 Freddy Xin     2013-03-02  1153  		do {
c006257c3aa36f6 David Kahurani 2022-04-04  1154  		    ret = ax88179_read_cmd(dev, AX_ACCESS_MAC, AX_SROM_CMD,
e2ca90c276e1fc4 Freddy Xin     2013-03-02  1155  					   1, 1, &buf);
e2ca90c276e1fc4 Freddy Xin     2013-03-02  1156  
c006257c3aa36f6 David Kahurani 2022-04-04  1157  		    if (ret < 0) {
c006257c3aa36f6 David Kahurani 2022-04-04  1158  			    netdev_dbg(dev->net,
c006257c3aa36f6 David Kahurani 2022-04-04  1159  				       "Failed to read SROM_CMD: %d\n",
c006257c3aa36f6 David Kahurani 2022-04-04  1160  			               ret);
c006257c3aa36f6 David Kahurani 2022-04-04  1161  			    return ret;
c006257c3aa36f6 David Kahurani 2022-04-04  1162  		    }
c006257c3aa36f6 David Kahurani 2022-04-04  1163  
e2ca90c276e1fc4 Freddy Xin     2013-03-02 @1164  			if (time_after(jiffies, jtimeout))
e2ca90c276e1fc4 Freddy Xin     2013-03-02  1165  				return -EINVAL;
e2ca90c276e1fc4 Freddy Xin     2013-03-02  1166  
e2ca90c276e1fc4 Freddy Xin     2013-03-02  1167  		} while (buf & EEP_BUSY);
e2ca90c276e1fc4 Freddy Xin     2013-03-02  1168  
c006257c3aa36f6 David Kahurani 2022-04-04  1169  		ret = __ax88179_read_cmd(dev, AX_ACCESS_MAC, AX_SROM_DATA_LOW,
e2ca90c276e1fc4 Freddy Xin     2013-03-02  1170  				         2, 2, &eeprom[i * 2], 0);
e2ca90c276e1fc4 Freddy Xin     2013-03-02  1171  
c006257c3aa36f6 David Kahurani 2022-04-04  1172  		if (ret < 0) {
c006257c3aa36f6 David Kahurani 2022-04-04  1173  			netdev_dbg(dev->net,
c006257c3aa36f6 David Kahurani 2022-04-04  1174  				   "Failed to read SROM_DATA_LOW: %d\n",
c006257c3aa36f6 David Kahurani 2022-04-04  1175  			           ret);
c006257c3aa36f6 David Kahurani 2022-04-04  1176  			return ret;
c006257c3aa36f6 David Kahurani 2022-04-04  1177  		}
c006257c3aa36f6 David Kahurani 2022-04-04  1178  
e2ca90c276e1fc4 Freddy Xin     2013-03-02  1179  		if ((i == 0) && (eeprom[0] == 0xFF))
e2ca90c276e1fc4 Freddy Xin     2013-03-02  1180  			return -EINVAL;
e2ca90c276e1fc4 Freddy Xin     2013-03-02  1181  	}
e2ca90c276e1fc4 Freddy Xin     2013-03-02  1182  
e2ca90c276e1fc4 Freddy Xin     2013-03-02  1183  	csum = eeprom[6] + eeprom[7] + eeprom[8] + eeprom[9];
e2ca90c276e1fc4 Freddy Xin     2013-03-02  1184  	csum = (csum >> 8) + (csum & 0xff);
e2ca90c276e1fc4 Freddy Xin     2013-03-02  1185  	if ((csum + eeprom[10]) != 0xff)
e2ca90c276e1fc4 Freddy Xin     2013-03-02  1186  		return -EINVAL;
e2ca90c276e1fc4 Freddy Xin     2013-03-02  1187  
e2ca90c276e1fc4 Freddy Xin     2013-03-02  1188  	return 0;
e2ca90c276e1fc4 Freddy Xin     2013-03-02  1189  }
e2ca90c276e1fc4 Freddy Xin     2013-03-02  1190  

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



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux