summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorClaudiu Beznea <claudiu.beznea.uj@bp.renesas.com>2023-11-28 10:04:35 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-12-08 08:44:27 +0100
commit7023a293e9817a4db1411ed2d2945bf49cf99ede (patch)
treef157f2a5291643dde0ceae15fb59329378729e76 /drivers
parent05aa8f3e3b77a707847967a6c0c9e98595ab6de5 (diff)
net: ravb: Use pm_runtime_resume_and_get()
[ Upstream commit 88b74831faaee455c2af380382d979fc38e79270 ] pm_runtime_get_sync() may return an error. In case it returns with an error dev->power.usage_count needs to be decremented. pm_runtime_resume_and_get() takes care of this. Thus use it. Fixes: c156633f1353 ("Renesas Ethernet AVB driver proper") Reviewed-by: Sergey Shtylyov <s.shtylyov@omp.ru> Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com> Signed-off-by: Paolo Abeni <pabeni@redhat.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/ethernet/renesas/ravb_main.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
index 765e55b489db..815aa1878216 100644
--- a/drivers/net/ethernet/renesas/ravb_main.c
+++ b/drivers/net/ethernet/renesas/ravb_main.c
@@ -2039,7 +2039,9 @@ static int ravb_probe(struct platform_device *pdev)
ndev->hw_features = NETIF_F_RXCSUM;
pm_runtime_enable(&pdev->dev);
- pm_runtime_get_sync(&pdev->dev);
+ error = pm_runtime_resume_and_get(&pdev->dev);
+ if (error < 0)
+ goto out_rpm_disable;
/* The Ether-specific entries in the device structure. */
ndev->base_addr = res->start;
@@ -2210,6 +2212,7 @@ out_release:
free_netdev(ndev);
pm_runtime_put(&pdev->dev);
+out_rpm_disable:
pm_runtime_disable(&pdev->dev);
return error;
}