[PATCH] can: flexcan: Fix runtime PM imbalance on error

From: Dinghao Liu
Date: Fri May 22 2020 - 05:44:03 EST


When register_flexcandev() returns an error code, a
pairing runtime PM usage counter decrement is needed
to keep the counter balanced.

Also, call pm_runtime_disable() when register_flexcandev()
returns an error code.

Signed-off-by: Dinghao Liu <dinghao.liu@xxxxxxxxxx>
---
drivers/net/can/flexcan.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c
index 94d10ec954a0..ea193426e5ae 100644
--- a/drivers/net/can/flexcan.c
+++ b/drivers/net/can/flexcan.c
@@ -1666,6 +1666,8 @@ static int flexcan_probe(struct platform_device *pdev)
return 0;

failed_register:
+ pm_runtime_put_noidle(&pdev->dev);
+ pm_runtime_disable(&pdev->dev);
free_candev(dev);
return err;
}
--
2.17.1