mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-06 22:55:11 +00:00
sh_eth: Remove goto statements that jump straight to a return
"goto" is well accepted for error paths in the kernel but should not be used unnecessarily. Return the correct value directly instead of using a goto when possible. Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Acked-by: Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
daacf03f0b
commit
f738a13d83
1 changed files with 9 additions and 21 deletions
|
@ -873,7 +873,7 @@ static int sh_eth_reset(struct net_device *ndev)
|
||||||
|
|
||||||
ret = sh_eth_check_reset(ndev);
|
ret = sh_eth_check_reset(ndev);
|
||||||
if (ret)
|
if (ret)
|
||||||
goto out;
|
return ret;
|
||||||
|
|
||||||
/* Table Init */
|
/* Table Init */
|
||||||
sh_eth_write(ndev, 0x0, TDLAR);
|
sh_eth_write(ndev, 0x0, TDLAR);
|
||||||
|
@ -900,7 +900,6 @@ static int sh_eth_reset(struct net_device *ndev)
|
||||||
EDMR);
|
EDMR);
|
||||||
}
|
}
|
||||||
|
|
||||||
out:
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1264,7 +1263,7 @@ static int sh_eth_dev_init(struct net_device *ndev, bool start)
|
||||||
/* Soft Reset */
|
/* Soft Reset */
|
||||||
ret = sh_eth_reset(ndev);
|
ret = sh_eth_reset(ndev);
|
||||||
if (ret)
|
if (ret)
|
||||||
goto out;
|
return ret;
|
||||||
|
|
||||||
if (mdp->cd->rmiimode)
|
if (mdp->cd->rmiimode)
|
||||||
sh_eth_write(ndev, 0x1, RMIIMODE);
|
sh_eth_write(ndev, 0x1, RMIIMODE);
|
||||||
|
@ -1343,7 +1342,6 @@ static int sh_eth_dev_init(struct net_device *ndev, bool start)
|
||||||
netif_start_queue(ndev);
|
netif_start_queue(ndev);
|
||||||
}
|
}
|
||||||
|
|
||||||
out:
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2605,10 +2603,8 @@ static int sh_mdio_init(struct sh_eth_private *mdp,
|
||||||
|
|
||||||
/* create bit control struct for PHY */
|
/* create bit control struct for PHY */
|
||||||
bitbang = devm_kzalloc(dev, sizeof(struct bb_info), GFP_KERNEL);
|
bitbang = devm_kzalloc(dev, sizeof(struct bb_info), GFP_KERNEL);
|
||||||
if (!bitbang) {
|
if (!bitbang)
|
||||||
ret = -ENOMEM;
|
return -ENOMEM;
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* bitbang init */
|
/* bitbang init */
|
||||||
bitbang->addr = mdp->addr + mdp->reg_offset[PIR];
|
bitbang->addr = mdp->addr + mdp->reg_offset[PIR];
|
||||||
|
@ -2621,10 +2617,8 @@ static int sh_mdio_init(struct sh_eth_private *mdp,
|
||||||
|
|
||||||
/* MII controller setting */
|
/* MII controller setting */
|
||||||
mdp->mii_bus = alloc_mdio_bitbang(&bitbang->ctrl);
|
mdp->mii_bus = alloc_mdio_bitbang(&bitbang->ctrl);
|
||||||
if (!mdp->mii_bus) {
|
if (!mdp->mii_bus)
|
||||||
ret = -ENOMEM;
|
return -ENOMEM;
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Hook up MII support for ethtool */
|
/* Hook up MII support for ethtool */
|
||||||
mdp->mii_bus->name = "sh_mii";
|
mdp->mii_bus->name = "sh_mii";
|
||||||
|
@ -2659,8 +2653,6 @@ static int sh_mdio_init(struct sh_eth_private *mdp,
|
||||||
|
|
||||||
out_free_bus:
|
out_free_bus:
|
||||||
free_mdio_bitbang(mdp->mii_bus);
|
free_mdio_bitbang(mdp->mii_bus);
|
||||||
|
|
||||||
out:
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2773,15 +2765,12 @@ static int sh_eth_drv_probe(struct platform_device *pdev)
|
||||||
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||||
if (unlikely(res == NULL)) {
|
if (unlikely(res == NULL)) {
|
||||||
dev_err(&pdev->dev, "invalid resource\n");
|
dev_err(&pdev->dev, "invalid resource\n");
|
||||||
ret = -EINVAL;
|
return -EINVAL;
|
||||||
goto out;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ndev = alloc_etherdev(sizeof(struct sh_eth_private));
|
ndev = alloc_etherdev(sizeof(struct sh_eth_private));
|
||||||
if (!ndev) {
|
if (!ndev)
|
||||||
ret = -ENOMEM;
|
return -ENOMEM;
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* The sh Ether-specific entries in the device structure. */
|
/* The sh Ether-specific entries in the device structure. */
|
||||||
ndev->base_addr = res->start;
|
ndev->base_addr = res->start;
|
||||||
|
@ -2922,7 +2911,6 @@ out_release:
|
||||||
if (ndev)
|
if (ndev)
|
||||||
free_netdev(ndev);
|
free_netdev(ndev);
|
||||||
|
|
||||||
out:
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue