Skip to contentSkip to conversation

net: ethernet: dwmac: Fix an error code in imx_dwmac_probe()

PATCH Applied Dan Carpenter 3 participants 3 messages Jun 3, 2020 – Jun 4, 2020

Subsystems (6)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: ethernet: dwmac: Fix an error code in imx_dwmac_probe()

The code is return PTR_ERR(NULL) which is zero or success. We should return -ENOMEM instead.

Fixes 94abdad6974a5 ("net: ethernet: dwmac: add ethernet glue logic for NXP imx8 chip")
---
 drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c +1 -1
index 5010af7dab4af..3c5df5eeed6c8 100644
@@ -225,7 +225,7 @@ static int imx_dwmac_probe(struct platform_device *pdev)
 
 	dwmac = devm_kzalloc(&pdev->dev, sizeof(*dwmac), GFP_KERNEL);
 	if (!dwmac)
-		return PTR_ERR(dwmac);
+		return -ENOMEM;
 
 	plat_dat = stmmac_probe_config_dt(pdev, &stmmac_res.mac);
 	if (IS_ERR(plat_dat))
Signature · 1 line
2.26.2
Acked-by on v1 1/1
#1 lore raw

From: Dan Carpenter <[email protected]> Sent: Thursday, June 4, 2020 1:50 AM

Quoted 6 lines

The code is return PTR_ERR(NULL) which is zero or success. We should return -ENOMEM instead.

Fixes 94abdad6974a5 ("net: ethernet: dwmac: add ethernet glue logic for

NXP imx8 chip")

Thanks!

Quoted 22 lines
---
 drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c +1 -1
index 5010af7dab4af..3c5df5eeed6c8 100644
@@ -225,7 +225,7 @@ static int imx_dwmac_probe(struct platform_device
 *pdev)
 
        dwmac = devm_kzalloc(&pdev->dev, sizeof(*dwmac),
 GFP_KERNEL);
        if (!dwmac)
-               return PTR_ERR(dwmac);
+               return -ENOMEM;
 
        plat_dat = stmmac_probe_config_dt(pdev, &stmmac_res.mac);
        if (IS_ERR(plat_dat))

--
2.26.2