diff mbox series

watchdog: Fix runtime PM imbalance on error

Message ID 20200521080141.24373-1-dinghao.liu@zju.edu.cn (mailing list archive)
State Accepted
Headers show
Series watchdog: Fix runtime PM imbalance on error | expand

Commit Message

Dinghao Liu May 21, 2020, 8:01 a.m. UTC
When watchdog_register_device() returns an error code,
a pairing runtime PM usage counter decrement is needed
to keep the counter balanced.

Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
---
 drivers/watchdog/omap_wdt.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Guenter Roeck May 21, 2020, 12:57 p.m. UTC | #1
On 5/21/20 1:01 AM, Dinghao Liu wrote:
> When watchdog_register_device() returns an error code,
> a pairing runtime PM usage counter decrement is needed
> to keep the counter balanced.
> 
> Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>

Reviewed-by: Guenter Roeck <linux@roeck-us.net>

> ---
>  drivers/watchdog/omap_wdt.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/watchdog/omap_wdt.c b/drivers/watchdog/omap_wdt.c
> index 9b91882fe3c4..1616f93dfad7 100644
> --- a/drivers/watchdog/omap_wdt.c
> +++ b/drivers/watchdog/omap_wdt.c
> @@ -273,6 +273,7 @@ static int omap_wdt_probe(struct platform_device *pdev)
>  
>  	ret = watchdog_register_device(&wdev->wdog);
>  	if (ret) {
> +		pm_runtime_put(wdev->dev);
>  		pm_runtime_disable(wdev->dev);
>  		return ret;
>  	}
>
diff mbox series

Patch

diff --git a/drivers/watchdog/omap_wdt.c b/drivers/watchdog/omap_wdt.c
index 9b91882fe3c4..1616f93dfad7 100644
--- a/drivers/watchdog/omap_wdt.c
+++ b/drivers/watchdog/omap_wdt.c
@@ -273,6 +273,7 @@  static int omap_wdt_probe(struct platform_device *pdev)
 
 	ret = watchdog_register_device(&wdev->wdog);
 	if (ret) {
+		pm_runtime_put(wdev->dev);
 		pm_runtime_disable(wdev->dev);
 		return ret;
 	}