net: macb: Fix runtime PM refcounting
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Mon, 27 Apr 2020 10:51:20 +0000 (13:51 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 14 May 2020 05:58:18 +0000 (07:58 +0200)
commit8e16ede5b7a1ff2218b528f57a5b7f908a9195a1
tree4f7ce2359c7a2029757c3971ce29f183019c35ea
parenteb6f88cd81ac82f3b6a6727d469e519abd57dca4
net: macb: Fix runtime PM refcounting

[ Upstream commit 0ce205d4660c312cdeb4a81066616dcc6f3799c4 ]

The commit e6a41c23df0d, 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: e6a41c23df0d ("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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/cadence/macb_main.c