From: Vladimir Oltean <vladimir.oltean@nxp.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: "kernel-janitors@vger.kernel.org" <kernel-janitors@vger.kernel.org>
Subject: Re: [bug report] net: pcs: xpcs: convert to phylink_pcs_ops
Date: Tue, 8 Jun 2021 12:37:08 +0000 [thread overview]
Message-ID: <20210608123708.eofu2dlgzop3d667@skbuf> (raw)
In-Reply-To: <YL9hTvz8QOo/+lu7@mwanda>
Hello Dan Carpenter,
On Tue, Jun 08, 2021 at 03:23:42PM +0300, Dan Carpenter wrote:
> 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
This should be solved here:
https://lore.kernel.org/netdev/20210604112825.011148a3@canb.auug.org.au/
next prev parent reply other threads:[~2021-06-08 12:37 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-08 12:23 [bug report] net: pcs: xpcs: convert to phylink_pcs_ops Dan Carpenter
2021-06-08 12:37 ` Vladimir Oltean [this message]
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=20210608123708.eofu2dlgzop3d667@skbuf \
--to=vladimir.oltean@nxp.com \
--cc=dan.carpenter@oracle.com \
--cc=kernel-janitors@vger.kernel.org \
/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