]> git.baikalelectronics.ru Git - kernel.git/commitdiff
serial: 8250: omap: Fix unpaired pm_runtime_put_sync() in omap8250_remove()
authorTony Lindgren <tony@atomide.com>
Fri, 28 Oct 2022 10:58:13 +0000 (13:58 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 25 Nov 2022 16:42:13 +0000 (17:42 +0100)
[ Upstream commit e3f0c638f428fd66b5871154b62706772045f91a ]

On remove, we get an error for "Runtime PM usage count underflow!". I guess
this driver is mostly built-in, and this issue has gone unnoticed for a
while. Somehow I did not catch this issue with my earlier fix done with
commit afc5aa7b6470 ("serial: 8250_omap: Fix probe and remove for PM
runtime").

Fixes: afc5aa7b6470 ("serial: 8250_omap: Fix probe and remove for PM runtime")
Signed-off-by: Tony Lindgren <tony@atomide.com>
Depends-on: c4a28fe77ffc ("PM: runtime: Add pm_runtime_resume_and_get to deal with usage counter")
Link: https://lore.kernel.org/r/20221028105813.54290-1-tony@atomide.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/tty/serial/8250/8250_omap.c

index 090acaced3b1f92ed90f415eb16ddd55e0d0e134..6e46524e0e7338d5a9626746f5ef8a98f0d93b14 100644 (file)
@@ -1273,6 +1273,11 @@ err:
 static int omap8250_remove(struct platform_device *pdev)
 {
        struct omap8250_priv *priv = platform_get_drvdata(pdev);
+       int err;
+
+       err = pm_runtime_resume_and_get(&pdev->dev);
+       if (err)
+               return err;
 
        pm_runtime_dont_use_autosuspend(&pdev->dev);
        pm_runtime_put_sync(&pdev->dev);