Re: [PATCH net-next 1/2] of: net: move nvmem_get_mac_address() into of_get_mac_addr_nvmem()

From: kernel test robot
Date: Fri Oct 15 2021 - 06:01:38 EST


Hi Yajun,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on net-next/master]

url: https://github.com/0day-ci/linux/commits/Yajun-Deng/of-net-move-nvmem_get_mac_address-into-of_get_mac_addr_nvmem/20211013-162802
base: https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git d1f24712a86abd04d82cf4b00fb4ab8ff2d23c8a
config: arc-allyesconfig (attached as .config)
compiler: arceb-elf-gcc (GCC) 11.2.0
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
# https://github.com/0day-ci/linux/commit/10748c5429eced2d22c6cf10e8dcdef8a1a5c38d
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Yajun-Deng/of-net-move-nvmem_get_mac_address-into-of_get_mac_addr_nvmem/20211013-162802
git checkout 10748c5429eced2d22c6cf10e8dcdef8a1a5c38d
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross ARCH=arc

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

All errors (new ones prefixed by >>):

net/core/of_net.c: In function 'of_get_mac_addr_nvmem':
>> net/core/of_net.c:66:13: error: unused variable 'ret' [-Werror=unused-variable]
66 | int ret;
| ^~~
cc1: all warnings being treated as errors


vim +/ret +66 net/core/of_net.c

3eb46a1da78dff drivers/of/of_net.c Sergei Shtylyov 2015-03-18 59
83216e3988cd19 drivers/of/of_net.c Michael Walle 2021-04-12 60 static int of_get_mac_addr_nvmem(struct device_node *np, u8 *addr)
d01f449c008a3f drivers/of/of_net.c Petr Štetiar 2019-05-03 61 {
d01f449c008a3f drivers/of/of_net.c Petr Štetiar 2019-05-03 62 struct platform_device *pdev = of_find_device_by_node(np);
f10843e04a0752 drivers/of/of_net.c Michael Walle 2021-04-12 63 struct nvmem_cell *cell;
f10843e04a0752 drivers/of/of_net.c Michael Walle 2021-04-12 64 const void *mac;
f10843e04a0752 drivers/of/of_net.c Michael Walle 2021-04-12 65 size_t len;
83216e3988cd19 drivers/of/of_net.c Michael Walle 2021-04-12 @66 int ret;
d01f449c008a3f drivers/of/of_net.c Petr Štetiar 2019-05-03 67
f10843e04a0752 drivers/of/of_net.c Michael Walle 2021-04-12 68 /* Try lookup by device first, there might be a nvmem_cell_lookup
f10843e04a0752 drivers/of/of_net.c Michael Walle 2021-04-12 69 * associated with a given device.
f10843e04a0752 drivers/of/of_net.c Michael Walle 2021-04-12 70 */
10748c5429eced net/core/of_net.c Yajun Deng 2021-10-13 71 if (pdev)
10748c5429eced net/core/of_net.c Yajun Deng 2021-10-13 72 cell = nvmem_cell_get(&pdev->dev, "mac-address");
10748c5429eced net/core/of_net.c Yajun Deng 2021-10-13 73 else
f10843e04a0752 drivers/of/of_net.c Michael Walle 2021-04-12 74 cell = of_nvmem_cell_get(np, "mac-address");
10748c5429eced net/core/of_net.c Yajun Deng 2021-10-13 75
f10843e04a0752 drivers/of/of_net.c Michael Walle 2021-04-12 76 if (IS_ERR(cell))
f10843e04a0752 drivers/of/of_net.c Michael Walle 2021-04-12 77 return PTR_ERR(cell);
f10843e04a0752 drivers/of/of_net.c Michael Walle 2021-04-12 78
f10843e04a0752 drivers/of/of_net.c Michael Walle 2021-04-12 79 mac = nvmem_cell_read(cell, &len);
f10843e04a0752 drivers/of/of_net.c Michael Walle 2021-04-12 80 nvmem_cell_put(cell);
f10843e04a0752 drivers/of/of_net.c Michael Walle 2021-04-12 81
f10843e04a0752 drivers/of/of_net.c Michael Walle 2021-04-12 82 if (IS_ERR(mac))
f10843e04a0752 drivers/of/of_net.c Michael Walle 2021-04-12 83 return PTR_ERR(mac);
f10843e04a0752 drivers/of/of_net.c Michael Walle 2021-04-12 84
f10843e04a0752 drivers/of/of_net.c Michael Walle 2021-04-12 85 if (len != ETH_ALEN || !is_valid_ether_addr(mac)) {
f10843e04a0752 drivers/of/of_net.c Michael Walle 2021-04-12 86 kfree(mac);
f10843e04a0752 drivers/of/of_net.c Michael Walle 2021-04-12 87 return -EINVAL;
f10843e04a0752 drivers/of/of_net.c Michael Walle 2021-04-12 88 }
f10843e04a0752 drivers/of/of_net.c Michael Walle 2021-04-12 89
10748c5429eced net/core/of_net.c Yajun Deng 2021-10-13 90 ether_addr_copy(addr, mac);
f10843e04a0752 drivers/of/of_net.c Michael Walle 2021-04-12 91 kfree(mac);
f10843e04a0752 drivers/of/of_net.c Michael Walle 2021-04-12 92
10748c5429eced net/core/of_net.c Yajun Deng 2021-10-13 93 if (pdev)
10748c5429eced net/core/of_net.c Yajun Deng 2021-10-13 94 put_device(&pdev->dev);
10748c5429eced net/core/of_net.c Yajun Deng 2021-10-13 95
f10843e04a0752 drivers/of/of_net.c Michael Walle 2021-04-12 96 return 0;
f10843e04a0752 drivers/of/of_net.c Michael Walle 2021-04-12 97 }
f10843e04a0752 drivers/of/of_net.c Michael Walle 2021-04-12 98

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip