Skip to content

Commit

Permalink
net: phy: fixed-phy: Make the error path simpler
Browse files Browse the repository at this point in the history
When platform_device_register_simple() fails we can return
the error immediately instead of jumping to the 'err_pdev'
label.

This makes the error path a bit simpler.

Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Fabio Estevam authored and David S. Miller committed Jun 24, 2018
1 parent dd55c4e commit b0c1638
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions drivers/net/phy/fixed_phy.c
Original file line number Diff line number Diff line change
Expand Up @@ -259,10 +259,8 @@ static int __init fixed_mdio_bus_init(void)
int ret;

pdev = platform_device_register_simple("Fixed MDIO bus", 0, NULL, 0);
if (IS_ERR(pdev)) {
ret = PTR_ERR(pdev);
goto err_pdev;
}
if (IS_ERR(pdev))
return PTR_ERR(pdev);

fmb->mii_bus = mdiobus_alloc();
if (fmb->mii_bus == NULL) {
Expand All @@ -287,7 +285,6 @@ static int __init fixed_mdio_bus_init(void)
mdiobus_free(fmb->mii_bus);
err_mdiobus_reg:
platform_device_unregister(pdev);
err_pdev:
return ret;
}
module_init(fixed_mdio_bus_init);
Expand Down

0 comments on commit b0c1638

Please sign in to comment.