net: macb: Fix runtime PM refcounting
The commite6a41c23df, while trying to fix an issue, ("net: macb: ensure interface is not suspended on at91rm9200") introduced a refcounting regression, because in error case refcounter must be balanced. Fix it by calling pm_runtime_put_noidle() in error case. While here, fix the same mistake in other couple of places. Fixes:e6a41c23df("net: macb: ensure interface is not suspended on at91rm9200") Cc: Alexandre Belloni <alexandre.belloni@bootlin.com> Cc: Claudiu Beznea <claudiu.beznea@microchip.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
ee8d2267f0
commit
0ce205d466
@@ -334,8 +334,10 @@ static int macb_mdio_read(struct mii_bus *bus, int mii_id, int regnum)
|
|||||||
int status;
|
int status;
|
||||||
|
|
||||||
status = pm_runtime_get_sync(&bp->pdev->dev);
|
status = pm_runtime_get_sync(&bp->pdev->dev);
|
||||||
if (status < 0)
|
if (status < 0) {
|
||||||
|
pm_runtime_put_noidle(&bp->pdev->dev);
|
||||||
goto mdio_pm_exit;
|
goto mdio_pm_exit;
|
||||||
|
}
|
||||||
|
|
||||||
status = macb_mdio_wait_for_idle(bp);
|
status = macb_mdio_wait_for_idle(bp);
|
||||||
if (status < 0)
|
if (status < 0)
|
||||||
@@ -386,8 +388,10 @@ static int macb_mdio_write(struct mii_bus *bus, int mii_id, int regnum,
|
|||||||
int status;
|
int status;
|
||||||
|
|
||||||
status = pm_runtime_get_sync(&bp->pdev->dev);
|
status = pm_runtime_get_sync(&bp->pdev->dev);
|
||||||
if (status < 0)
|
if (status < 0) {
|
||||||
|
pm_runtime_put_noidle(&bp->pdev->dev);
|
||||||
goto mdio_pm_exit;
|
goto mdio_pm_exit;
|
||||||
|
}
|
||||||
|
|
||||||
status = macb_mdio_wait_for_idle(bp);
|
status = macb_mdio_wait_for_idle(bp);
|
||||||
if (status < 0)
|
if (status < 0)
|
||||||
@@ -3816,8 +3820,10 @@ static int at91ether_open(struct net_device *dev)
|
|||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = pm_runtime_get_sync(&lp->pdev->dev);
|
ret = pm_runtime_get_sync(&lp->pdev->dev);
|
||||||
if (ret < 0)
|
if (ret < 0) {
|
||||||
|
pm_runtime_put_noidle(&lp->pdev->dev);
|
||||||
return ret;
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
/* Clear internal statistics */
|
/* Clear internal statistics */
|
||||||
ctl = macb_readl(lp, NCR);
|
ctl = macb_readl(lp, NCR);
|
||||||
|
|||||||
Reference in New Issue
Block a user