OSDN Git Service

net: ethernet: dwmac: Fix an error code in imx_dwmac_probe()
authorDan Carpenter <dan.carpenter@oracle.com>
Wed, 3 Jun 2020 17:50:25 +0000 (20:50 +0300)
committerDavid S. Miller <davem@davemloft.net>
Thu, 4 Jun 2020 22:51:25 +0000 (15:51 -0700)
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")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c

index 5010af7..3c5df5e 100644 (file)
@@ -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))