[linux-next:master 1524/2290] drivers/net/ethernet/cadence/macb_main.c:540 macb_validate() error: uninitialized symbol 'have_1g'.

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

 



tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   5191249f880367a4cd675825cd721a8d78f26a45
commit: 3ad4b7c81a992463c29ae130332c217607fe4452 [1524/2290] net: macb: Fix several edge cases in validate
config: arm-randconfig-m031-20211116 (attached as .config)
compiler: arm-linux-gnueabi-gcc (GCC) 11.2.0

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

New smatch warnings:
drivers/net/ethernet/cadence/macb_main.c:540 macb_validate() error: uninitialized symbol 'have_1g'.
drivers/net/ethernet/cadence/macb_main.c:546 macb_validate() error: uninitialized symbol 'have_sgmii'.
drivers/net/ethernet/cadence/macb_main.c:552 macb_validate() error: uninitialized symbol 'have_10g'.

Old smatch warnings:
drivers/net/ethernet/cadence/macb_main.c:569 macb_validate() error: uninitialized symbol 'have_10g'.
drivers/net/ethernet/cadence/macb_main.c:579 macb_validate() error: uninitialized symbol 'have_sgmii'.
drivers/net/ethernet/cadence/macb_main.c:588 macb_validate() error: uninitialized symbol 'have_1g'.

vim +/have_1g +540 drivers/net/ethernet/cadence/macb_main.c

7897b071ac3b45a drivers/net/ethernet/cadence/macb_main.c Antoine Tenart        2019-11-13  509  static void macb_validate(struct phylink_config *config,
7897b071ac3b45a drivers/net/ethernet/cadence/macb_main.c Antoine Tenart        2019-11-13  510  			  unsigned long *supported,
7897b071ac3b45a drivers/net/ethernet/cadence/macb_main.c Antoine Tenart        2019-11-13  511  			  struct phylink_link_state *state)
6c36a7074436e18 drivers/net/macb.c                       frederic RODO         2007-07-12  512  {
7897b071ac3b45a drivers/net/ethernet/cadence/macb_main.c Antoine Tenart        2019-11-13  513  	struct net_device *ndev = to_net_dev(config->dev);
7897b071ac3b45a drivers/net/ethernet/cadence/macb_main.c Antoine Tenart        2019-11-13  514  	__ETHTOOL_DECLARE_LINK_MODE_MASK(mask) = { 0, };
7897b071ac3b45a drivers/net/ethernet/cadence/macb_main.c Antoine Tenart        2019-11-13  515  	struct macb *bp = netdev_priv(ndev);
3ad4b7c81a99246 drivers/net/ethernet/cadence/macb_main.c Sean Anderson         2021-11-12  516  	bool have_1g, have_sgmii, have_10g;
3ad4b7c81a99246 drivers/net/ethernet/cadence/macb_main.c Sean Anderson         2021-11-12  517  
3ad4b7c81a99246 drivers/net/ethernet/cadence/macb_main.c Sean Anderson         2021-11-12  518  	/* Determine what modes are supported */
3ad4b7c81a99246 drivers/net/ethernet/cadence/macb_main.c Sean Anderson         2021-11-12  519  	if (macb_is_gem(bp) &&
3ad4b7c81a99246 drivers/net/ethernet/cadence/macb_main.c Sean Anderson         2021-11-12  520  	    (bp->caps & MACB_CAPS_GIGABIT_MODE_AVAILABLE)) {
3ad4b7c81a99246 drivers/net/ethernet/cadence/macb_main.c Sean Anderson         2021-11-12  521  		have_1g = true;

have_1g is set to true, but it's never set to false.  Same for other
warnings.

3ad4b7c81a99246 drivers/net/ethernet/cadence/macb_main.c Sean Anderson         2021-11-12  522  		if (bp->caps & MACB_CAPS_PCS)
3ad4b7c81a99246 drivers/net/ethernet/cadence/macb_main.c Sean Anderson         2021-11-12  523  			have_sgmii = true;
3ad4b7c81a99246 drivers/net/ethernet/cadence/macb_main.c Sean Anderson         2021-11-12  524  		if (bp->caps & MACB_CAPS_HIGH_SPEED)
3ad4b7c81a99246 drivers/net/ethernet/cadence/macb_main.c Sean Anderson         2021-11-12  525  			have_10g = true;
3ad4b7c81a99246 drivers/net/ethernet/cadence/macb_main.c Sean Anderson         2021-11-12  526  	}
3ad4b7c81a99246 drivers/net/ethernet/cadence/macb_main.c Sean Anderson         2021-11-12  527  
3ad4b7c81a99246 drivers/net/ethernet/cadence/macb_main.c Sean Anderson         2021-11-12  528  	/* Eliminate unsupported modes */
3ad4b7c81a99246 drivers/net/ethernet/cadence/macb_main.c Sean Anderson         2021-11-12  529  	switch (state->interface) {
3ad4b7c81a99246 drivers/net/ethernet/cadence/macb_main.c Sean Anderson         2021-11-12  530  	case PHY_INTERFACE_MODE_NA:
3ad4b7c81a99246 drivers/net/ethernet/cadence/macb_main.c Sean Anderson         2021-11-12  531  	case PHY_INTERFACE_MODE_MII:
3ad4b7c81a99246 drivers/net/ethernet/cadence/macb_main.c Sean Anderson         2021-11-12  532  	case PHY_INTERFACE_MODE_RMII:
3ad4b7c81a99246 drivers/net/ethernet/cadence/macb_main.c Sean Anderson         2021-11-12  533  		break;
7897b071ac3b45a drivers/net/ethernet/cadence/macb_main.c Antoine Tenart        2019-11-13  534  
3ad4b7c81a99246 drivers/net/ethernet/cadence/macb_main.c Sean Anderson         2021-11-12  535  	case PHY_INTERFACE_MODE_GMII:
3ad4b7c81a99246 drivers/net/ethernet/cadence/macb_main.c Sean Anderson         2021-11-12  536  	case PHY_INTERFACE_MODE_RGMII:
3ad4b7c81a99246 drivers/net/ethernet/cadence/macb_main.c Sean Anderson         2021-11-12  537  	case PHY_INTERFACE_MODE_RGMII_ID:
3ad4b7c81a99246 drivers/net/ethernet/cadence/macb_main.c Sean Anderson         2021-11-12  538  	case PHY_INTERFACE_MODE_RGMII_RXID:
3ad4b7c81a99246 drivers/net/ethernet/cadence/macb_main.c Sean Anderson         2021-11-12  539  	case PHY_INTERFACE_MODE_RGMII_TXID:
3ad4b7c81a99246 drivers/net/ethernet/cadence/macb_main.c Sean Anderson         2021-11-12 @540  		if (have_1g)
3ad4b7c81a99246 drivers/net/ethernet/cadence/macb_main.c Sean Anderson         2021-11-12  541  			break;
4973056cceacc70 drivers/net/ethernet/cadence/macb_main.c Sean Anderson         2021-10-22  542  		linkmode_zero(supported);
7897b071ac3b45a drivers/net/ethernet/cadence/macb_main.c Antoine Tenart        2019-11-13  543  		return;
89e5785fc8a6b9e drivers/net/macb.c                       Haavard Skinnemoen    2006-11-09  544  
3ad4b7c81a99246 drivers/net/ethernet/cadence/macb_main.c Sean Anderson         2021-11-12  545  	case PHY_INTERFACE_MODE_SGMII:
3ad4b7c81a99246 drivers/net/ethernet/cadence/macb_main.c Sean Anderson         2021-11-12 @546  		if (have_sgmii)
3ad4b7c81a99246 drivers/net/ethernet/cadence/macb_main.c Sean Anderson         2021-11-12  547  			break;
4973056cceacc70 drivers/net/ethernet/cadence/macb_main.c Sean Anderson         2021-10-22  548  		linkmode_zero(supported);
7897b071ac3b45a drivers/net/ethernet/cadence/macb_main.c Antoine Tenart        2019-11-13  549  		return;
89e5785fc8a6b9e drivers/net/macb.c                       Haavard Skinnemoen    2006-11-09  550  
3ad4b7c81a99246 drivers/net/ethernet/cadence/macb_main.c Sean Anderson         2021-11-12  551  	case PHY_INTERFACE_MODE_10GBASER:
3ad4b7c81a99246 drivers/net/ethernet/cadence/macb_main.c Sean Anderson         2021-11-12 @552  		if (have_10g)
3ad4b7c81a99246 drivers/net/ethernet/cadence/macb_main.c Sean Anderson         2021-11-12  553  			break;
3ad4b7c81a99246 drivers/net/ethernet/cadence/macb_main.c Sean Anderson         2021-11-12  554  		fallthrough;
3ad4b7c81a99246 drivers/net/ethernet/cadence/macb_main.c Sean Anderson         2021-11-12  555  
3ad4b7c81a99246 drivers/net/ethernet/cadence/macb_main.c Sean Anderson         2021-11-12  556  	default:
4973056cceacc70 drivers/net/ethernet/cadence/macb_main.c Sean Anderson         2021-10-22  557  		linkmode_zero(supported);
e4e143e26ce8f5f drivers/net/ethernet/cadence/macb_main.c Parshuram Thombare    2020-10-29  558  		return;
e4e143e26ce8f5f drivers/net/ethernet/cadence/macb_main.c Parshuram Thombare    2020-10-29  559  	}
e4e143e26ce8f5f drivers/net/ethernet/cadence/macb_main.c Parshuram Thombare    2020-10-29  560  
7897b071ac3b45a drivers/net/ethernet/cadence/macb_main.c Antoine Tenart        2019-11-13  561  	phylink_set_port_modes(mask);
7897b071ac3b45a drivers/net/ethernet/cadence/macb_main.c Antoine Tenart        2019-11-13  562  	phylink_set(mask, Autoneg);
7897b071ac3b45a drivers/net/ethernet/cadence/macb_main.c Antoine Tenart        2019-11-13  563  	phylink_set(mask, Asym_Pause);
6c36a7074436e18 drivers/net/macb.c                       frederic RODO         2007-07-12  564  
3ad4b7c81a99246 drivers/net/ethernet/cadence/macb_main.c Sean Anderson         2021-11-12  565  	/* And set the appropriate mask */
3ad4b7c81a99246 drivers/net/ethernet/cadence/macb_main.c Sean Anderson         2021-11-12  566  	switch (state->interface) {
3ad4b7c81a99246 drivers/net/ethernet/cadence/macb_main.c Sean Anderson         2021-11-12  567  	case PHY_INTERFACE_MODE_NA:
3ad4b7c81a99246 drivers/net/ethernet/cadence/macb_main.c Sean Anderson         2021-11-12  568  	case PHY_INTERFACE_MODE_10GBASER:
3ad4b7c81a99246 drivers/net/ethernet/cadence/macb_main.c Sean Anderson         2021-11-12  569  		if (have_10g) {
14ad41c74f6be0b drivers/net/ethernet/cadence/macb_main.c Russell King (Oracle  2021-10-04  570) 			phylink_set_10g_modes(mask);
e4e143e26ce8f5f drivers/net/ethernet/cadence/macb_main.c Parshuram Thombare    2020-10-29  571  			phylink_set(mask, 10000baseKR_Full);
e4e143e26ce8f5f drivers/net/ethernet/cadence/macb_main.c Parshuram Thombare    2020-10-29  572  		}
3ad4b7c81a99246 drivers/net/ethernet/cadence/macb_main.c Sean Anderson         2021-11-12  573  		if (state->interface != PHY_INTERFACE_MODE_NA)
3ad4b7c81a99246 drivers/net/ethernet/cadence/macb_main.c Sean Anderson         2021-11-12  574  			break;
3ad4b7c81a99246 drivers/net/ethernet/cadence/macb_main.c Sean Anderson         2021-11-12  575  		fallthrough;
e4e143e26ce8f5f drivers/net/ethernet/cadence/macb_main.c Parshuram Thombare    2020-10-29  576  
3ad4b7c81a99246 drivers/net/ethernet/cadence/macb_main.c Sean Anderson         2021-11-12  577  	/* FIXME: Do we actually support 10/100 for SGMII? Half duplex? */
3ad4b7c81a99246 drivers/net/ethernet/cadence/macb_main.c Sean Anderson         2021-11-12  578  	case PHY_INTERFACE_MODE_SGMII:
3ad4b7c81a99246 drivers/net/ethernet/cadence/macb_main.c Sean Anderson         2021-11-12  579  		if (!have_sgmii && state->interface != PHY_INTERFACE_MODE_NA)
3ad4b7c81a99246 drivers/net/ethernet/cadence/macb_main.c Sean Anderson         2021-11-12  580  			break;
3ad4b7c81a99246 drivers/net/ethernet/cadence/macb_main.c Sean Anderson         2021-11-12  581  		fallthrough;
3ad4b7c81a99246 drivers/net/ethernet/cadence/macb_main.c Sean Anderson         2021-11-12  582  
3ad4b7c81a99246 drivers/net/ethernet/cadence/macb_main.c Sean Anderson         2021-11-12  583  	case PHY_INTERFACE_MODE_GMII:
3ad4b7c81a99246 drivers/net/ethernet/cadence/macb_main.c Sean Anderson         2021-11-12  584  	case PHY_INTERFACE_MODE_RGMII:
3ad4b7c81a99246 drivers/net/ethernet/cadence/macb_main.c Sean Anderson         2021-11-12  585  	case PHY_INTERFACE_MODE_RGMII_ID:
3ad4b7c81a99246 drivers/net/ethernet/cadence/macb_main.c Sean Anderson         2021-11-12  586  	case PHY_INTERFACE_MODE_RGMII_RXID:
3ad4b7c81a99246 drivers/net/ethernet/cadence/macb_main.c Sean Anderson         2021-11-12  587  	case PHY_INTERFACE_MODE_RGMII_TXID:
3ad4b7c81a99246 drivers/net/ethernet/cadence/macb_main.c Sean Anderson         2021-11-12  588  		if (have_1g) {
7897b071ac3b45a drivers/net/ethernet/cadence/macb_main.c Antoine Tenart        2019-11-13  589  			phylink_set(mask, 1000baseT_Full);
7897b071ac3b45a drivers/net/ethernet/cadence/macb_main.c Antoine Tenart        2019-11-13  590  			phylink_set(mask, 1000baseX_Full);
6c36a7074436e18 drivers/net/macb.c                       frederic RODO         2007-07-12  591  
7897b071ac3b45a drivers/net/ethernet/cadence/macb_main.c Antoine Tenart        2019-11-13  592  			if (!(bp->caps & MACB_CAPS_NO_GIGABIT_HALF))
7897b071ac3b45a drivers/net/ethernet/cadence/macb_main.c Antoine Tenart        2019-11-13  593  				phylink_set(mask, 1000baseT_Half);
3ad4b7c81a99246 drivers/net/ethernet/cadence/macb_main.c Sean Anderson         2021-11-12  594  		} else if (state->interface != PHY_INTERFACE_MODE_NA) {
3ad4b7c81a99246 drivers/net/ethernet/cadence/macb_main.c Sean Anderson         2021-11-12  595  			break;
6c36a7074436e18 drivers/net/macb.c                       frederic RODO         2007-07-12  596  		}
3ad4b7c81a99246 drivers/net/ethernet/cadence/macb_main.c Sean Anderson         2021-11-12  597  		fallthrough;
3ad4b7c81a99246 drivers/net/ethernet/cadence/macb_main.c Sean Anderson         2021-11-12  598  
3ad4b7c81a99246 drivers/net/ethernet/cadence/macb_main.c Sean Anderson         2021-11-12  599  	default:
3ad4b7c81a99246 drivers/net/ethernet/cadence/macb_main.c Sean Anderson         2021-11-12  600  		phylink_set(mask, 10baseT_Half);
3ad4b7c81a99246 drivers/net/ethernet/cadence/macb_main.c Sean Anderson         2021-11-12  601  		phylink_set(mask, 10baseT_Full);
3ad4b7c81a99246 drivers/net/ethernet/cadence/macb_main.c Sean Anderson         2021-11-12  602  		phylink_set(mask, 100baseT_Half);
3ad4b7c81a99246 drivers/net/ethernet/cadence/macb_main.c Sean Anderson         2021-11-12  603  		phylink_set(mask, 100baseT_Full);
3ad4b7c81a99246 drivers/net/ethernet/cadence/macb_main.c Sean Anderson         2021-11-12  604  		break;
3ad4b7c81a99246 drivers/net/ethernet/cadence/macb_main.c Sean Anderson         2021-11-12  605  	}
3ad4b7c81a99246 drivers/net/ethernet/cadence/macb_main.c Sean Anderson         2021-11-12  606  
4973056cceacc70 drivers/net/ethernet/cadence/macb_main.c Sean Anderson         2021-10-22  607  	linkmode_and(supported, supported, mask);
4973056cceacc70 drivers/net/ethernet/cadence/macb_main.c Sean Anderson         2021-10-22  608  	linkmode_and(state->advertising, state->advertising, mask);
89e5785fc8a6b9e drivers/net/macb.c                       Haavard Skinnemoen    2006-11-09  609  }

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





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux