netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] dpaa2-eth: check fsl_mc_get_endpoint for IS_ERR_OR_NULL()
@ 2020-07-14 12:08 Ioana Ciornei
  2020-07-16  0:38 ` Jakub Kicinski
  0 siblings, 1 reply; 2+ messages in thread
From: Ioana Ciornei @ 2020-07-14 12:08 UTC (permalink / raw)
  To: davem, netdev; +Cc: Ioana Ciornei

The fsl_mc_get_endpoint() function can return an error or directly a
NULL pointer in case the peer device is not under the root DPRC
container. Treat this case also, otherwise it would lead to a NULL
pointer when trying to access the peer fsl_mc_device.

Fixes: 719479230893 ("dpaa2-eth: add MAC/PHY support through phylink")
Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
---
 drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
index f150cd454fa4..0998ceb1a26e 100644
--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
+++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
@@ -3632,7 +3632,7 @@ static int dpaa2_eth_connect_mac(struct dpaa2_eth_priv *priv)
 
 	dpni_dev = to_fsl_mc_device(priv->net_dev->dev.parent);
 	dpmac_dev = fsl_mc_get_endpoint(dpni_dev);
-	if (IS_ERR(dpmac_dev) || dpmac_dev->dev.type != &fsl_mc_bus_dpmac_type)
+	if (IS_ERR_OR_NULL(dpmac_dev) || dpmac_dev->dev.type != &fsl_mc_bus_dpmac_type)
 		return 0;
 
 	if (dpaa2_mac_is_type_fixed(dpmac_dev, priv->mc_io))
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net] dpaa2-eth: check fsl_mc_get_endpoint for IS_ERR_OR_NULL()
  2020-07-14 12:08 [PATCH net] dpaa2-eth: check fsl_mc_get_endpoint for IS_ERR_OR_NULL() Ioana Ciornei
@ 2020-07-16  0:38 ` Jakub Kicinski
  0 siblings, 0 replies; 2+ messages in thread
From: Jakub Kicinski @ 2020-07-16  0:38 UTC (permalink / raw)
  To: Ioana Ciornei; +Cc: davem, netdev

On Tue, 14 Jul 2020 15:08:16 +0300 Ioana Ciornei wrote:
> The fsl_mc_get_endpoint() function can return an error or directly a
> NULL pointer in case the peer device is not under the root DPRC
> container. Treat this case also, otherwise it would lead to a NULL
> pointer when trying to access the peer fsl_mc_device.
> 
> Fixes: 719479230893 ("dpaa2-eth: add MAC/PHY support through phylink")
> Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>

Applied, thanks!

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-07-16  0:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-14 12:08 [PATCH net] dpaa2-eth: check fsl_mc_get_endpoint for IS_ERR_OR_NULL() Ioana Ciornei
2020-07-16  0:38 ` Jakub Kicinski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).