Add the missing free_netdev() before return from function
cpmac_probe() in the error handling case.
This patch revert commit
0465be8f4f1d ("net: cpmac: fix in
releasing resources"), which changed to only free_netdev
while register_netdev failed.
Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: David S. Miller <davem@davemloft.net>
mem = platform_get_resource_byname(pdev, IORESOURCE_MEM, "regs");
if (!mem) {
rc = -ENODEV;
- goto out;
+ goto fail;
}
dev->irq = platform_get_irq_byname(pdev, "irq");
dev_err(&pdev->dev, "Could not attach to PHY\n");
rc = PTR_ERR(phydev);
- goto out;
+ goto fail;
}
rc = register_netdev(dev);
fail:
free_netdev(dev);
-out:
return rc;
}