Skip to content

Commit

Permalink
net: smsc911x: Fix runtime PM imbalance on error
Browse files Browse the repository at this point in the history
Remove runtime PM usage counter decrement when the
increment function has not been called to keep the
counter balanced.

Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Dinghao Liu authored and David S. Miller committed May 23, 2020
1 parent e3181e9 commit 539d39a
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions drivers/net/ethernet/smsc/smsc911x.c
Original file line number Diff line number Diff line change
@@ -2493,20 +2493,20 @@ static int smsc911x_drv_probe(struct platform_device *pdev)

retval = smsc911x_init(dev);
if (retval < 0)
goto out_disable_resources;
goto out_init_fail;

netif_carrier_off(dev);

retval = smsc911x_mii_init(pdev, dev);
if (retval) {
SMSC_WARN(pdata, probe, "Error %i initialising mii", retval);
goto out_disable_resources;
goto out_init_fail;
}

retval = register_netdev(dev);
if (retval) {
SMSC_WARN(pdata, probe, "Error %i registering device", retval);
goto out_disable_resources;
goto out_init_fail;
} else {
SMSC_TRACE(pdata, probe,
"Network interface: \"%s\"", dev->name);
@@ -2547,9 +2547,10 @@ static int smsc911x_drv_probe(struct platform_device *pdev)

return 0;

out_disable_resources:
out_init_fail:
pm_runtime_put(&pdev->dev);
pm_runtime_disable(&pdev->dev);
out_disable_resources:
(void)smsc911x_disable_resources(pdev);
out_enable_resources_fail:
smsc911x_free_resources(pdev);

0 comments on commit 539d39a

Please sign in to comment.