From: Dan Carpenter <dan.carpenter@oracle.com>
To: vladimir.oltean@nxp.com
Cc: kernel-janitors@vger.kernel.org
Subject: [bug report] net: pcs: xpcs: convert to phylink_pcs_ops
Date: Tue, 8 Jun 2021 15:23:42 +0300 [thread overview]
Message-ID: <YL9hTvz8QOo/+lu7@mwanda> (raw)
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
next reply other threads:[~2021-06-08 12:24 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-08 12:23 Dan Carpenter [this message]
2021-06-08 12:37 ` [bug report] net: pcs: xpcs: convert to phylink_pcs_ops Vladimir Oltean
2021-06-08 12:54 ` Dan Carpenter
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=YL9hTvz8QOo/+lu7@mwanda \
--to=dan.carpenter@oracle.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=vladimir.oltean@nxp.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.