Skip to contentSkip to conversation

serial: 8250: omap: Fix unpaired pm_runtime_put_sync() in omap8250_remove()

PATCH New Tony Lindgren 1 participant 1 message Oct 28, 2022 TTY layer and serial drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 serial: 8250: omap: Fix unpaired pm_runtime_put_sync() in omap8250_remove()

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 4e0f5cc65098 ("serial: 8250_omap: Fix probe and remove for PM runtime").

Fixes 4e0f5cc65098 ("serial: 8250_omap: Fix probe and remove for PM runtime")

Depends-on: dd8088d5a896 ("PM: runtime: Add pm_runtime_resume_and_get to deal with usage counter")

---
 drivers/tty/serial/8250/8250_omap.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/tty/serial/8250/8250_omap.c +5 -0
@@ -1476,6 +1476,11 @@ static int omap8250_probe(struct platform_device *pdev)
 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);
Signature · 1 line
2.37.3