All of lore.kernel.org
 help / color / mirror / Atom feed
* [frank-w-bpi-r2-4.14:6.18-rc 110/110] drivers/net/phy/as21xxx.c:432:20: warning: variable 'ret' set but not used
@ 2025-10-12  5:55 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2025-10-12  5:55 UTC (permalink / raw)
  To: Frank Wunderlich; +Cc: oe-kbuild-all

tree:   https://github.com/frank-w/BPI-R2-4.14 6.18-rc
head:   936e993c16c5c695eb2ce063a5a11f122a580727
commit: 936e993c16c5c695eb2ce063a5a11f122a580727 [110/110] net: phy: as21: try the driver from mtk-sdk
config: s390-randconfig-001-20251012 (https://download.01.org/0day-ci/archive/20251012/202510121325.ml2pXWd7-lkp@intel.com/config)
compiler: s390-linux-gcc (GCC) 8.5.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251012/202510121325.ml2pXWd7-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202510121325.ml2pXWd7-lkp@intel.com/

All warnings (new ones prefixed by >>):

   drivers/net/phy/as21xxx.c: In function 'aeon_set_default_value':
>> drivers/net/phy/as21xxx.c:432:20: warning: variable 'ret' set but not used [-Wunused-but-set-variable]
     int pos = 0, val, ret = 0, remaining;
                       ^~~
   drivers/net/phy/as21xxx.c: At top level:
   drivers/net/phy/as21xxx.c:1333:18: warning: initialized field overwritten [-Woverride-init]
      .read_status = as21xxx_read_status,
                     ^~~~~~~~~~~~~~~~~~~
   drivers/net/phy/as21xxx.c:1333:18: note: (near initialization for 'as21xxx_drivers[2].read_status')
   drivers/net/phy/as21xxx.c:1350:18: warning: initialized field overwritten [-Woverride-init]
      .read_status = as21xxx_read_status,
                     ^~~~~~~~~~~~~~~~~~~
   drivers/net/phy/as21xxx.c:1350:18: note: (near initialization for 'as21xxx_drivers[3].read_status')
   drivers/net/phy/as21xxx.c:1367:18: warning: initialized field overwritten [-Woverride-init]
      .read_status = as21xxx_read_status,
                     ^~~~~~~~~~~~~~~~~~~
   drivers/net/phy/as21xxx.c:1367:18: note: (near initialization for 'as21xxx_drivers[4].read_status')
   drivers/net/phy/as21xxx.c:1384:18: warning: initialized field overwritten [-Woverride-init]
      .read_status = as21xxx_read_status,
                     ^~~~~~~~~~~~~~~~~~~
   drivers/net/phy/as21xxx.c:1384:18: note: (near initialization for 'as21xxx_drivers[5].read_status')
   drivers/net/phy/as21xxx.c:1401:18: warning: initialized field overwritten [-Woverride-init]
      .read_status = as21xxx_read_status,
                     ^~~~~~~~~~~~~~~~~~~
   drivers/net/phy/as21xxx.c:1401:18: note: (near initialization for 'as21xxx_drivers[6].read_status')
   drivers/net/phy/as21xxx.c:1418:18: warning: initialized field overwritten [-Woverride-init]
      .read_status = as21xxx_read_status,
                     ^~~~~~~~~~~~~~~~~~~
   drivers/net/phy/as21xxx.c:1418:18: note: (near initialization for 'as21xxx_drivers[7].read_status')
   drivers/net/phy/as21xxx.c:1435:18: warning: initialized field overwritten [-Woverride-init]
      .read_status = as21xxx_read_status,
                     ^~~~~~~~~~~~~~~~~~~
   drivers/net/phy/as21xxx.c:1435:18: note: (near initialization for 'as21xxx_drivers[8].read_status')
   drivers/net/phy/as21xxx.c:1452:18: warning: initialized field overwritten [-Woverride-init]
      .read_status = as21xxx_read_status,
                     ^~~~~~~~~~~~~~~~~~~
   drivers/net/phy/as21xxx.c:1452:18: note: (near initialization for 'as21xxx_drivers[9].read_status')
   drivers/net/phy/as21xxx.c:1469:18: warning: initialized field overwritten [-Woverride-init]
      .read_status = as21xxx_read_status,
                     ^~~~~~~~~~~~~~~~~~~
   drivers/net/phy/as21xxx.c:1469:18: note: (near initialization for 'as21xxx_drivers[10].read_status')


vim +/ret +432 drivers/net/phy/as21xxx.c

   424	
   425	static int aeon_set_default_value(struct phy_device *phydev)
   426	{
   427		static const unsigned char base_data[] = {0x32, 0x30, 0x32, 0x33, 0x30, 0x37, 0x31, 0x34};
   428		unsigned char bytebuf[16];
   429		unsigned short *wdata;
   430		unsigned int mask;
   431		int byte_count, wdata_count = 0;
 > 432		int pos = 0, val, ret = 0, remaining;
   433		unsigned char padded_bytes[MEM_WORD_SIZE] = {0};
   434		mask = param1 | 14;
   435		memcpy(bytebuf, base_data, sizeof(base_data));
   436		bytebuf[8] = mask & 0xff;
   437		bytebuf[9] = (mask >> 8) & 0xff;
   438		byte_count = 10;
   439		wdata = kmalloc(MAX_WDATA_SIZE * sizeof(unsigned short), GFP_KERNEL);
   440		if (!wdata) {
   441			pr_err("Failed to allocate wdata array\n");
   442			return -ENOMEM;
   443		}
   444		while (pos + MEM_WORD_SIZE <= byte_count) {
   445			if (wdata_count + 2 > MAX_WDATA_SIZE) {
   446				pr_err("wdata array overflow\n");
   447				ret = -ENOSPC;
   448				goto cleanup;
   449			}
   450			wdata[wdata_count++] = le16_to_cpu(*(unsigned short *)&bytebuf[pos]);
   451			wdata[wdata_count++] = le16_to_cpu(*(unsigned short *)&bytebuf[pos + 2]);
   452			pos += MEM_WORD_SIZE;
   453		}
   454		remaining = byte_count - pos;
   455		if (remaining > 0) {
   456			if (wdata_count + 2 <= MAX_WDATA_SIZE) {
   457				// Here we just need padded_bytes once, otherwise we need to read from mem
   458				memcpy(padded_bytes, &bytebuf[pos], remaining);
   459				wdata[wdata_count++] = le16_to_cpu(*(unsigned short *)&padded_bytes[0]);
   460				wdata[wdata_count++] = le16_to_cpu(*(unsigned short *)&padded_bytes[2]);
   461			}
   462		}
   463		val = aeon_cl45_read(phydev, MDIO_MMD_VEND1, VEND1_GLB_REG_CPU_CTRL); //GLB_REG_CPU_CTRL
   464		val |= 0x12;
   465		phy_write_mmd(phydev, MDIO_MMD_VEND1, VEND1_GLB_REG_CPU_CTRL, val);
   466		phy_write_mmd(phydev, MDIO_MMD_VEND1, VEND1_FW_START_ADDR,
   467				(u16)(AEON_MEM_DEFAULT_ADDR & 0xFFFF));
   468		phy_modify_mmd(phydev, MDIO_MMD_VEND1,
   469				VEND1_GLB_REG_MDIO_INDIRECT_ADDRCMD,
   470				0x3ffc, 0xc000);
   471		aeon_cl45_write_burst(phydev, MDIO_MMD_VEND1, VEND1_GLB_REG_MDIO_INDIRECT_LOAD,
   472				(unsigned char *)wdata, wdata_count*2);
   473		val = aeon_cl45_read(phydev, MDIO_MMD_VEND1,
   474				VEND1_GLB_REG_MDIO_INDIRECT_ADDRCMD); //GLB_REG_MDIO_INDIRECT_ADDRCMD
   475		val &= 0x3FFF;
   476		phy_write_mmd(phydev, MDIO_MMD_VEND1, VEND1_GLB_REG_MDIO_INDIRECT_ADDRCMD, val);
   477		val = aeon_cl45_read(phydev, MDIO_MMD_VEND1, VEND1_GLB_REG_CPU_CTRL); //GLB_REG_CPU_CTRL
   478		val &= 0xFFED;
   479		phy_write_mmd(phydev, MDIO_MMD_VEND1, VEND1_GLB_REG_CPU_CTRL, val);
   480	cleanup:
   481		kfree(wdata);
   482		return 0;
   483	}
   484	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2025-10-12  5:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-12  5:55 [frank-w-bpi-r2-4.14:6.18-rc 110/110] drivers/net/phy/as21xxx.c:432:20: warning: variable 'ret' set but not used kernel test robot

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.