[kabel:net-queue-work 61/74] drivers/net/phy/marvell10g.c:514:3: warning: variable 'priv' is uninitialized when used here

From: kernel test robot
Date: Sat Nov 06 2021 - 19:19:04 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/kabel/linux.git net-queue-work
head: 402bab37786daa196ed983b84b37c7c8e4a4e90f
commit: 28b417cdb278d693f59f1206fe60e34db565b63a [61/74] net: phy: marvell10g: allow PHY to probe without firmware
config: riscv-buildonly-randconfig-r001-20211106 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 627868263cd4d57c230b61904483a3dad9e1a1da)
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 riscv cross compiling tool for clang build
# apt-get install binutils-riscv64-linux-gnu
# https://git.kernel.org/pub/scm/linux/kernel/git/kabel/linux.git/commit/?id=28b417cdb278d693f59f1206fe60e34db565b63a
git remote add kabel https://git.kernel.org/pub/scm/linux/kernel/git/kabel/linux.git
git fetch --no-tags kabel net-queue-work
git checkout 28b417cdb278d693f59f1206fe60e34db565b63a
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=riscv

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

All warnings (new ones prefixed by >>):

>> drivers/net/phy/marvell10g.c:514:3: warning: variable 'priv' is uninitialized when used here [-Wuninitialized]
priv->firmware_failed = true;
^~~~
drivers/net/phy/marvell10g.c:499:26: note: initialize the variable 'priv' to silence this warning
struct mv3310_priv *priv;
^
= NULL
1 warning generated.


vim +/priv +514 drivers/net/phy/marvell10g.c

495
496 static int mv3310_probe(struct phy_device *phydev)
497 {
498 const struct mv3310_chip *chip = to_mv3310_chip(phydev);
499 struct mv3310_priv *priv;
500 u32 mmd_mask = MDIO_DEVS_PMAPMD | MDIO_DEVS_AN;
501 int ret;
502
503 if (!phydev->is_c45 ||
504 (phydev->c45_ids.devices_in_package & mmd_mask) != mmd_mask)
505 return -ENODEV;
506
507 ret = phy_read_mmd(phydev, MDIO_MMD_PMAPMD, MV_PMA_BOOT);
508 if (ret < 0)
509 return ret;
510
511 if (ret & MV_PMA_BOOT_FATAL) {
512 dev_warn(&phydev->mdio.dev,
513 "PHY failed to boot firmware, status=%04x\n", ret);
> 514 priv->firmware_failed = true;
515 }
516
517 priv = devm_kzalloc(&phydev->mdio.dev, sizeof(*priv), GFP_KERNEL);
518 if (!priv)
519 return -ENOMEM;
520
521 dev_set_drvdata(&phydev->mdio.dev, priv);
522
523 ret = phy_read_mmd(phydev, MDIO_MMD_PMAPMD, MV_PMA_FW_VER0);
524 if (ret < 0)
525 return ret;
526
527 priv->firmware_ver = ret << 16;
528
529 ret = phy_read_mmd(phydev, MDIO_MMD_PMAPMD, MV_PMA_FW_VER1);
530 if (ret < 0)
531 return ret;
532
533 priv->firmware_ver |= ret;
534
535 phydev_info(phydev, "Firmware version %u.%u.%u.%u\n",
536 priv->firmware_ver >> 24, (priv->firmware_ver >> 16) & 255,
537 (priv->firmware_ver >> 8) & 255, priv->firmware_ver & 255);
538
539 if (chip->has_downshift)
540 priv->has_downshift = chip->has_downshift(phydev);
541
542 /* Powering down the port when not in use saves about 600mW */
543 ret = mv3310_power_down(phydev);
544 if (ret)
545 return ret;
546
547 ret = mv3310_hwmon_probe(phydev);
548 if (ret)
549 return ret;
550
551 chip->init_supported_interfaces(phydev->supported_interfaces);
552
553 return phy_sfp_probe(phydev, &mv3310_sfp_ops);
554 }
555

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

Attachment: .config.gz
Description: application/gzip