net: smsc911x: Fix runtime PM imbalance on error
authorDinghao Liu <dinghao.liu@zju.edu.cn>
Sat, 23 May 2020 08:08:20 +0000 (16:08 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 11 Jun 2020 07:22:19 +0000 (09:22 +0200)
[ Upstream commit 539d39ad0c61b35f69565a037d7586deaf6d6166 ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/smsc/smsc911x.c

index 4143659615e1095d46353088a43dd68f8d838fb7..264136dba674196ed35126078d02ad677a1772fb 100644 (file)
@@ -2506,20 +2506,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);
@@ -2560,9 +2560,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);