net: pcs: xpcs: convert to phylink_pcs_ops
Hello Vladimir Oltean,
The patch 11059740e616: "net: pcs: xpcs: convert to phylink_pcs_ops" from Jun 2, 2021, leads to the following static checker warning:
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:1237 stmmac_phy_setup()
error: we previously assumed 'mdio_bus_data' could be null (see line 1225)
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
1215 static int stmmac_phy_setup(struct stmmac_priv *priv) 1216 {
1217 struct stmmac_mdio_bus_data *mdio_bus_data = priv->plat->mdio_bus_data;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1218 struct fwnode_handle *fwnode = of_fwnode_handle(priv->plat->phylink_node);
1219 int mode = priv->plat->phy_interface;
1220 struct phylink *phylink;
1221
1222 priv->phylink_config.dev = &priv->dev->dev;
1223 priv->phylink_config.type = PHYLINK_NETDEV;
1224 priv->phylink_config.pcs_poll = true;
1225 if (priv->plat->mdio_bus_data)
^^^^^^^^^^^^^^^^^^^^^^^^^This old code assumes mdio_bus_data can be NULL.
1226 priv->phylink_config.ovr_an_inband =
1227 mdio_bus_data->xpcs_an_inband;
1228
1229 if (!fwnode)
1230 fwnode = dev_fwnode(priv->device);
1231
1232 phylink = phylink_create(&priv->phylink_config, fwnode,
1233 mode, &stmmac_phylink_mac_ops);
1234 if (IS_ERR(phylink))
1235 return PTR_ERR(phylink);
1236
1237 if (mdio_bus_data->has_xpcs) {
^^^^^^^^^^^^^^^^^^^^^^^Unchecked dereference.
1238 struct mdio_xpcs_args *xpcs = priv->hw->xpcs; 1239 1240 phylink_set_pcs(phylink, &xpcs->pcs); 1241 } 1242 1243 priv->phylink = phylink; 1244 return 0; 1245 }
regards,
dan carpenter
Hello Dan Carpenter,
Quoted 48 lines · Dan Carpenter
Hello Vladimir Oltean,
The patch
11059740e616: "net: pcs: xpcs: convert tophylink_pcs_ops" from Jun 2, 2021, leads to the following static checker warning:
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:1237stmmac_phy_setup()
error: we previously assumed 'mdio_bus_data' could be null (see line 1225)
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
1215 static intstmmac_phy_setup(struct stmmac_priv *priv)1216 {1217 struct stmmac_mdio_bus_data *mdio_bus_data = priv->plat->mdio_bus_data; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1218 struct fwnode_handle *fwnode = of_fwnode_handle(priv->plat->phylink_node); 1219 int mode = priv->plat->phy_interface; 1220 struct phylink *phylink; 1221 1222 priv->phylink_config.dev = &priv->dev->dev; 1223 priv->phylink_config.type = PHYLINK_NETDEV; 1224 priv->phylink_config.pcs_poll = true; 1225 if (priv->plat->mdio_bus_data) ^^^^^^^^^^^^^^^^^^^^^^^^^This old code assumes
mdio_bus_datacan be NULL.1226
priv->phylink_config.ovr_an_inband=
1227mdio_bus_data->xpcs_an_inband;
1228
1229 if (!fwnode)
1230 fwnode =dev_fwnode(priv->device);
1231
1232 phylink = phylink_create(&priv->phylink_config, fwnode,
1233 mode,&stmmac_phylink_mac_ops);
1234 if (IS_ERR(phylink))
1235 returnPTR_ERR(phylink);
12361237 if (mdio_bus_data->has_xpcs) { ^^^^^^^^^^^^^^^^^^^^^^^Unchecked dereference.
1238 struct mdio_xpcs_args *xpcs = priv->hw->xpcs; 1239 1240 phylink_set_pcs(phylink, &xpcs->pcs); 1241 } 1242 1243 priv->phylink = phylink; 1244 return 0; 1245 }
Quoted 2 lines
regards,
dan carpenter
This should be solved here:
https://lore.kernel.org/netdev/[email protected]/
Quoted 51 lines · Vladimir Oltean
Hello Dan Carpenter,
Quoted 48 lines · Dan Carpenter
Hello Vladimir Oltean,
The patch
11059740e616: "net: pcs: xpcs: convert tophylink_pcs_ops" from Jun 2, 2021, leads to the following static checker warning:
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:1237stmmac_phy_setup()
error: we previously assumed 'mdio_bus_data' could be null (see line 1225)
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
1215 static intstmmac_phy_setup(struct stmmac_priv *priv)1216 {1217 struct stmmac_mdio_bus_data *mdio_bus_data = priv->plat->mdio_bus_data; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1218 struct fwnode_handle *fwnode = of_fwnode_handle(priv->plat->phylink_node); 1219 int mode = priv->plat->phy_interface; 1220 struct phylink *phylink; 1221 1222 priv->phylink_config.dev = &priv->dev->dev; 1223 priv->phylink_config.type = PHYLINK_NETDEV; 1224 priv->phylink_config.pcs_poll = true; 1225 if (priv->plat->mdio_bus_data) ^^^^^^^^^^^^^^^^^^^^^^^^^This old code assumes
mdio_bus_datacan be NULL.1226
priv->phylink_config.ovr_an_inband=
1227mdio_bus_data->xpcs_an_inband;
1228
1229 if (!fwnode)
1230 fwnode =dev_fwnode(priv->device);
1231
1232 phylink = phylink_create(&priv->phylink_config, fwnode,
1233 mode,&stmmac_phylink_mac_ops);
1234 if (IS_ERR(phylink))
1235 returnPTR_ERR(phylink);
12361237 if (mdio_bus_data->has_xpcs) { ^^^^^^^^^^^^^^^^^^^^^^^Unchecked dereference.
1238 struct mdio_xpcs_args *xpcs = priv->hw->xpcs; 1239 1240 phylink_set_pcs(phylink, &xpcs->pcs); 1241 } 1242 1243 priv->phylink = phylink; 1244 return 0; 1245 }
Quoted 5 lines
Quoted 2 lines
regards,
dan carpenterThis should be solved here:
https://lore.kernel.org/netdev/[email protected]/
Nope. That is a fix for merge conflict and it has been removed from today's linux-next. It's unrelated.
regards,
dan carpenter