before registering the the net device this code freeing net device
by using the label 'fail'
fixed by introducing an another label 'out'
Signed-off-by: Varka Bhadram <varkab@cdac.in>
Signed-off-by: David S. Miller <davem@davemloft.net>
mem = platform_get_resource_byname(pdev, IORESOURCE_MEM, "regs");
if (!mem) {
rc = -ENODEV;
- goto fail;
+ goto out;
}
dev->irq = platform_get_irq_byname(pdev, "irq");
dev_err(&pdev->dev, "Could not attach to PHY\n");
rc = PTR_ERR(priv->phy);
- goto fail;
+ goto out;
}
rc = register_netdev(dev);
fail:
free_netdev(dev);
+out:
return rc;
}