Re: [PATCH v2 net-next] net: phy: mchp: Add 1588 support for LAN8814 Quad PHY

From: kernel test robot
Date: Thu Dec 17 2020 - 21:44:41 EST


Hi Divya,

Thank you for the patch! Perhaps something to improve:

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

url: https://github.com/0day-ci/linux/commits/Divya-Koppera/net-phy-mchp-Add-1588-support-for-LAN8814-Quad-PHY/20201215-020140
base: https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git 13458ffe0a953e17587f172a8e5059c243e6850a
config: powerpc-randconfig-r025-20201217 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project cee1e7d14f4628d6174b33640d502bff3b54ae45)
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 powerpc cross compiling tool for clang build
# apt-get install binutils-powerpc-linux-gnu
# https://github.com/0day-ci/linux/commit/d92cad561db30d2e4d3e70352b2f715b5c775fe8
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Divya-Koppera/net-phy-mchp-Add-1588-support-for-LAN8814-Quad-PHY/20201215-020140
git checkout d92cad561db30d2e4d3e70352b2f715b5c775fe8
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=powerpc

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/micrel.c:1641:6: warning: variable 'rxcfg' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
if (lan8814->hwts_rx_en && (lan8814->layer & PTP_CLASS_L2))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/phy/micrel.c:1657:66: note: uninitialized use occurs here
lan8814_write_page_reg(lan8814->phydev, 5, PTP_RX_PARSE_CONFIG, rxcfg);
^~~~~
drivers/net/phy/micrel.c:1641:2: note: remove the 'if' if its condition is always true
if (lan8814->hwts_rx_en && (lan8814->layer & PTP_CLASS_L2))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/net/phy/micrel.c:1641:6: warning: variable 'rxcfg' is used uninitialized whenever '&&' condition is false [-Wsometimes-uninitialized]
if (lan8814->hwts_rx_en && (lan8814->layer & PTP_CLASS_L2))
^~~~~~~~~~~~~~~~~~~
drivers/net/phy/micrel.c:1657:66: note: uninitialized use occurs here
lan8814_write_page_reg(lan8814->phydev, 5, PTP_RX_PARSE_CONFIG, rxcfg);
^~~~~
drivers/net/phy/micrel.c:1641:6: note: remove the '&&' if its condition is always true
if (lan8814->hwts_rx_en && (lan8814->layer & PTP_CLASS_L2))
^~~~~~~~~~~~~~~~~~~~~~
drivers/net/phy/micrel.c:1597:18: note: initialize the variable 'rxcfg' to silence this warning
int txcfg, rxcfg;
^
= 0
>> drivers/net/phy/micrel.c:1644:6: warning: variable 'txcfg' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
if (lan8814->hwts_tx_en && (lan8814->layer & PTP_CLASS_L2))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/phy/micrel.c:1658:66: note: uninitialized use occurs here
lan8814_write_page_reg(lan8814->phydev, 5, PTP_TX_PARSE_CONFIG, txcfg);
^~~~~
drivers/net/phy/micrel.c:1644:2: note: remove the 'if' if its condition is always true
if (lan8814->hwts_tx_en && (lan8814->layer & PTP_CLASS_L2))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/net/phy/micrel.c:1644:6: warning: variable 'txcfg' is used uninitialized whenever '&&' condition is false [-Wsometimes-uninitialized]
if (lan8814->hwts_tx_en && (lan8814->layer & PTP_CLASS_L2))
^~~~~~~~~~~~~~~~~~~
drivers/net/phy/micrel.c:1658:66: note: uninitialized use occurs here
lan8814_write_page_reg(lan8814->phydev, 5, PTP_TX_PARSE_CONFIG, txcfg);
^~~~~
drivers/net/phy/micrel.c:1644:6: note: remove the '&&' if its condition is always true
if (lan8814->hwts_tx_en && (lan8814->layer & PTP_CLASS_L2))
^~~~~~~~~~~~~~~~~~~~~~
drivers/net/phy/micrel.c:1597:11: note: initialize the variable 'txcfg' to silence this warning
int txcfg, rxcfg;
^
= 0
4 warnings generated.


vim +1641 drivers/net/phy/micrel.c

1592
1593 static int lan8814_hwtstamp(struct mii_timestamper *mii_ts, struct ifreq *ifr)
1594 {
1595 struct lan8814_priv *lan8814 = container_of(mii_ts, struct lan8814_priv, mii_ts);
1596 struct hwtstamp_config config;
1597 int txcfg, rxcfg;
1598
1599 if (copy_from_user(&config, ifr->ifr_data, sizeof(config)))
1600 return -EFAULT;
1601
1602 lan8814->hwts_tx_en = config.tx_type;
1603
1604 lan8814->ptp.rx_filter = config.rx_filter;
1605 lan8814->ptp.tx_type = config.tx_type;
1606
1607 switch (config.rx_filter) {
1608 case HWTSTAMP_FILTER_NONE:
1609 lan8814->hwts_rx_en = 0;
1610 lan8814->layer = 0;
1611 lan8814->version = 0;
1612 break;
1613 case HWTSTAMP_FILTER_PTP_V2_L4_EVENT:
1614 case HWTSTAMP_FILTER_PTP_V2_L4_SYNC:
1615 case HWTSTAMP_FILTER_PTP_V2_L4_DELAY_REQ:
1616 lan8814->hwts_rx_en = 1;
1617 lan8814->layer = PTP_CLASS_L4;
1618 lan8814->version = PTP_CLASS_V2;
1619 break;
1620 case HWTSTAMP_FILTER_PTP_V2_L2_EVENT:
1621 case HWTSTAMP_FILTER_PTP_V2_L2_SYNC:
1622 case HWTSTAMP_FILTER_PTP_V2_L2_DELAY_REQ:
1623 lan8814->hwts_rx_en = 1;
1624 lan8814->layer = PTP_CLASS_L2;
1625 lan8814->version = PTP_CLASS_V2;
1626 break;
1627 case HWTSTAMP_FILTER_PTP_V2_EVENT:
1628 case HWTSTAMP_FILTER_PTP_V2_SYNC:
1629 case HWTSTAMP_FILTER_PTP_V2_DELAY_REQ:
1630 lan8814->hwts_rx_en = 1;
1631 lan8814->layer = PTP_CLASS_L4 | PTP_CLASS_L2;
1632 lan8814->version = PTP_CLASS_V2;
1633 break;
1634 default:
1635 return -ERANGE;
1636 }
1637
1638 lan8814_write_page_reg(lan8814->phydev, 5, PTP_RX_PARSE_CONFIG, 0);
1639 lan8814_write_page_reg(lan8814->phydev, 5, PTP_TX_PARSE_CONFIG, 0);
1640
> 1641 if (lan8814->hwts_rx_en && (lan8814->layer & PTP_CLASS_L2))
1642 rxcfg = PTP_RX_PARSE_CONFIG_LAYER2_EN_;
1643
> 1644 if (lan8814->hwts_tx_en && (lan8814->layer & PTP_CLASS_L2))
1645 txcfg = PTP_TX_PARSE_CONFIG_LAYER2_EN_;
1646
1647 if (lan8814->hwts_rx_en && (lan8814->layer & PTP_CLASS_L4))
1648 rxcfg |= PTP_RX_PARSE_CONFIG_IPV4_EN_;
1649
1650 if (lan8814->hwts_tx_en && (lan8814->layer & PTP_CLASS_L4))
1651 txcfg |= PTP_TX_PARSE_CONFIG_IPV4_EN_;
1652
1653 if (lan8814_ptp_is_enable(lan8814->phydev))
1654 lan8814_write_page_reg(lan8814->phydev, 4, PTP_CMD_CTL,
1655 PTP_CMD_CTL_PTP_DISABLE_);
1656
1657 lan8814_write_page_reg(lan8814->phydev, 5, PTP_RX_PARSE_CONFIG, rxcfg);
1658 lan8814_write_page_reg(lan8814->phydev, 5, PTP_TX_PARSE_CONFIG, txcfg);
1659 lan8814_write_page_reg(lan8814->phydev, 5, PTP_RX_TIMESTAMP_EN, 0x3);
1660 lan8814_write_page_reg(lan8814->phydev, 5, PTP_TX_TIMESTAMP_EN, 0x3);
1661 lan8814_write_page_reg(lan8814->phydev, 5, PTP_TX_PARSE_L2_ADDR_EN, 0);
1662 lan8814_write_page_reg(lan8814->phydev, 5, PTP_RX_PARSE_L2_ADDR_EN, 0);
1663
1664 lan8814_write_page_reg(lan8814->phydev, 4, PTP_CMD_CTL, PTP_CMD_CTL_PTP_ENABLE_);
1665 if (lan8814->hwts_tx_en == HWTSTAMP_TX_ONESTEP_SYNC) {
1666 lan8814_write_page_reg(lan8814->phydev, 5, PTP_TX_MOD,
1667 PTP_TX_MOD_TX_PTP_SYNC_TS_INSERT_);
1668 } else if (lan8814->hwts_tx_en == HWTSTAMP_TX_ON) {
1669 /* Enabling 2 step offloading and all option for TS insertion/correction fields */
1670 lan8814_write_page_reg(lan8814->phydev, 5, PTP_TX_MOD, 0x800);
1671 lan8814_config_ts_intr(lan8814->phydev);
1672 }
1673
1674 return copy_to_user(ifr->ifr_data, &config, sizeof(config)) ? -EFAULT : 0;
1675 }
1676

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

Attachment: .config.gz
Description: application/gzip