Building the Linux kernel with Clang and LLVM
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Christian Marangi <ansuelsmth@gmail.com>
Cc: llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev,
	0day robot <lkp@intel.com>
Subject: drivers/net/phy/phylink.c:1983:34: warning: variable 'pl' is uninitialized when used here
Date: Tue, 16 Jun 2026 01:01:01 +0200	[thread overview]
Message-ID: <202606160043.ahaHDwRS-lkp@intel.com> (raw)

tree:   https://github.com/intel-lab-lkp/linux/commits/Christian-Marangi/net-phylink-keep-and-use-MAC-supported_interfaces-in-phylink-struct/20260615-212009
head:   10bf93a42ff6fa44dfd5bc9e6f71cca15ba1750a
commit: b4845a8d884960b6aa5c8e16baa2604017e93fb9 net: phylink: introduce internal phylink PCS handling
date:   10 hours ago
config: x86_64-kexec (https://download.01.org/0day-ci/archive/20260616/202606160043.ahaHDwRS-lkp@intel.com/config)
compiler: clang version 22.0.0git (https://github.com/llvm/llvm-project f43d6834093b19baf79beda8c0337ab020ac5f17)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260616/202606160043.ahaHDwRS-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/202606160043.ahaHDwRS-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> drivers/net/phy/phylink.c:1983:34: warning: variable 'pl' is uninitialized when used here [-Wuninitialized]
    1983 |         if (config->num_possible_pcs && pl->mac_ops->mac_select_pcs) {
         |                                         ^~
   drivers/net/phy/phylink.c:1969:20: note: initialize the variable 'pl' to silence this warning
    1969 |         struct phylink *pl;
         |                           ^
         |                            = NULL
   1 warning generated.


vim +/pl +1983 drivers/net/phy/phylink.c

  1946	
  1947	/**
  1948	 * phylink_create() - create a phylink instance
  1949	 * @config: a pointer to the target &struct phylink_config
  1950	 * @fwnode: a pointer to a &struct fwnode_handle describing the network
  1951	 *	interface
  1952	 * @iface: the desired link mode defined by &typedef phy_interface_t
  1953	 * @mac_ops: a pointer to a &struct phylink_mac_ops for the MAC.
  1954	 *
  1955	 * Create a new phylink instance, and parse the link parameters found in @np.
  1956	 * This will parse in-band modes, fixed-link or SFP configuration.
  1957	 *
  1958	 * Note: the rtnl lock must not be held when calling this function.
  1959	 *
  1960	 * Returns a pointer to a &struct phylink, or an error-pointer value. Users
  1961	 * must use IS_ERR() to check for errors from this function.
  1962	 */
  1963	struct phylink *phylink_create(struct phylink_config *config,
  1964				       const struct fwnode_handle *fwnode,
  1965				       phy_interface_t iface,
  1966				       const struct phylink_mac_ops *mac_ops)
  1967	{
  1968		struct phylink_pcs *pcs;
  1969		struct phylink *pl;
  1970		int ret;
  1971	
  1972		/* Validate the supplied configuration */
  1973		if (phy_interface_empty(config->supported_interfaces)) {
  1974			dev_err(config->dev,
  1975				"phylink: error: empty supported_interfaces\n");
  1976			return ERR_PTR(-EINVAL);
  1977		}
  1978	
  1979		/*
  1980		 * Make sure either PCS internal validation or .mac_select_pcs
  1981		 * is used. Return error if both are defined.
  1982		 */
> 1983		if (config->num_possible_pcs && pl->mac_ops->mac_select_pcs) {
  1984			dev_err(config->dev,
  1985				"phylink: error: either phylink_config .num_possible_pcs or .mac_select_pcs must be used\n");
  1986			return ERR_PTR(-EINVAL);
  1987		}
  1988	
  1989		pl = kzalloc_obj(*pl);
  1990		if (!pl)
  1991			return ERR_PTR(-ENOMEM);
  1992	
  1993		mutex_init(&pl->phydev_mutex);
  1994		mutex_init(&pl->state_mutex);
  1995		INIT_WORK(&pl->resolve, phylink_resolve);
  1996		INIT_LIST_HEAD(&pl->pcs_list);
  1997	
  1998		/* Fill the PCS list with available PCS from phylink config */
  1999		ret = phylink_fill_available_pcs(pl, config);
  2000		if (ret < 0) {
  2001			kfree(pl);
  2002			return ERR_PTR(ret);
  2003		}
  2004	
  2005		/* Link available PCS to phylink */
  2006		list_for_each_entry(pcs, &pl->pcs_list, list)
  2007			pcs->phylink = pl;
  2008	
  2009		phy_interface_copy(pl->supported_interfaces,
  2010				   config->supported_interfaces);
  2011	
  2012		/* Update supported interfaces */
  2013		list_for_each_entry(pcs, &pl->pcs_list, list)
  2014			phy_interface_or(pl->supported_interfaces,
  2015					 pl->supported_interfaces,
  2016					 pcs->supported_interfaces);
  2017	
  2018		pl->config = config;
  2019		if (config->type == PHYLINK_NETDEV) {
  2020			pl->netdev = to_net_dev(config->dev);
  2021			netif_carrier_off(pl->netdev);
  2022		} else if (config->type == PHYLINK_DEV) {
  2023			pl->dev = config->dev;
  2024		} else {
  2025			kfree(pl);
  2026			return ERR_PTR(-EINVAL);
  2027		}
  2028	
  2029		pl->mac_supports_eee_ops = phylink_mac_implements_lpi(mac_ops);
  2030		pl->mac_supports_eee = pl->mac_supports_eee_ops &&
  2031				       pl->config->lpi_capabilities &&
  2032				       !phy_interface_empty(pl->config->lpi_interfaces);
  2033	
  2034		/* Set the default EEE configuration */
  2035		pl->eee_cfg.eee_enabled = pl->config->eee_enabled_default;
  2036		pl->eee_cfg.tx_lpi_enabled = pl->eee_cfg.eee_enabled;
  2037		pl->eee_cfg.tx_lpi_timer = pl->config->lpi_timer_default;
  2038	
  2039		pl->phy_state.interface = iface;
  2040		pl->link_interface = iface;
  2041		if (iface == PHY_INTERFACE_MODE_MOCA)
  2042			pl->link_port = PORT_BNC;
  2043		else
  2044			pl->link_port = PORT_MII;
  2045		pl->link_config.interface = iface;
  2046		pl->link_config.pause = MLO_PAUSE_AN;
  2047		pl->link_config.speed = SPEED_UNKNOWN;
  2048		pl->link_config.duplex = DUPLEX_UNKNOWN;
  2049		pl->pcs_state = PCS_STATE_DOWN;
  2050		pl->mac_ops = mac_ops;
  2051		__set_bit(PHYLINK_DISABLE_STOPPED, &pl->phylink_disable_state);
  2052		timer_setup(&pl->link_poll, phylink_fixed_poll, 0);
  2053	
  2054		linkmode_fill(pl->supported);
  2055		linkmode_copy(pl->link_config.advertising, pl->supported);
  2056		phylink_validate(pl, pl->supported, &pl->link_config);
  2057	
  2058		ret = phylink_parse_mode(pl, fwnode);
  2059		if (ret < 0) {
  2060			kfree(pl);
  2061			return ERR_PTR(ret);
  2062		}
  2063	
  2064		if (pl->cfg_link_an_mode == MLO_AN_FIXED) {
  2065			ret = phylink_parse_fixedlink(pl, fwnode);
  2066			if (ret < 0) {
  2067				kfree(pl);
  2068				return ERR_PTR(ret);
  2069			}
  2070		}
  2071	
  2072		pl->req_link_an_mode = pl->cfg_link_an_mode;
  2073	
  2074		ret = phylink_register_sfp(pl, fwnode);
  2075		if (ret < 0) {
  2076			kfree(pl);
  2077			return ERR_PTR(ret);
  2078		}
  2079	
  2080		return pl;
  2081	}
  2082	EXPORT_SYMBOL_GPL(phylink_create);
  2083	

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

                 reply	other threads:[~2026-06-15 23:01 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202606160043.ahaHDwRS-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=ansuelsmth@gmail.com \
    --cc=llvm@lists.linux.dev \
    --cc=oe-kbuild-all@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox