Commit 1c33c23b authored by Aditya Pakki's avatar Aditya Pakki Committed by Greg Kroah-Hartman

omapfb: fix multiple reference count leaks due to pm_runtime_get_sync

[ Upstream commit 78c2ce9b ]

On calling pm_runtime_get_sync() the reference count of the device
is incremented. In case of failure, decrement the
reference count before returning the error.
Signed-off-by: default avatarAditya Pakki <pakki001@umn.edu>
Cc: kjlu@umn.edu
Cc: wu000273@umn.edu
Cc: Allison Randal <allison@lohutok.net>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Enrico Weigelt <info@metux.net>
cc: "Andrew F. Davis" <afd@ti.com>
Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
Cc: Alexios Zavras <alexios.zavras@intel.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: default avatarBartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200614030528.128064-1-pakki001@umn.eduSigned-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 9e2c212d
...@@ -531,8 +531,11 @@ int dispc_runtime_get(void) ...@@ -531,8 +531,11 @@ int dispc_runtime_get(void)
DSSDBG("dispc_runtime_get\n"); DSSDBG("dispc_runtime_get\n");
r = pm_runtime_get_sync(&dispc.pdev->dev); r = pm_runtime_get_sync(&dispc.pdev->dev);
WARN_ON(r < 0); if (WARN_ON(r < 0)) {
return r < 0 ? r : 0; pm_runtime_put_sync(&dispc.pdev->dev);
return r;
}
return 0;
} }
EXPORT_SYMBOL(dispc_runtime_get); EXPORT_SYMBOL(dispc_runtime_get);
......
...@@ -1148,8 +1148,11 @@ static int dsi_runtime_get(struct platform_device *dsidev) ...@@ -1148,8 +1148,11 @@ static int dsi_runtime_get(struct platform_device *dsidev)
DSSDBG("dsi_runtime_get\n"); DSSDBG("dsi_runtime_get\n");
r = pm_runtime_get_sync(&dsi->pdev->dev); r = pm_runtime_get_sync(&dsi->pdev->dev);
WARN_ON(r < 0); if (WARN_ON(r < 0)) {
return r < 0 ? r : 0; pm_runtime_put_sync(&dsi->pdev->dev);
return r;
}
return 0;
} }
static void dsi_runtime_put(struct platform_device *dsidev) static void dsi_runtime_put(struct platform_device *dsidev)
......
...@@ -779,8 +779,11 @@ int dss_runtime_get(void) ...@@ -779,8 +779,11 @@ int dss_runtime_get(void)
DSSDBG("dss_runtime_get\n"); DSSDBG("dss_runtime_get\n");
r = pm_runtime_get_sync(&dss.pdev->dev); r = pm_runtime_get_sync(&dss.pdev->dev);
WARN_ON(r < 0); if (WARN_ON(r < 0)) {
return r < 0 ? r : 0; pm_runtime_put_sync(&dss.pdev->dev);
return r;
}
return 0;
} }
void dss_runtime_put(void) void dss_runtime_put(void)
......
...@@ -50,9 +50,10 @@ static int hdmi_runtime_get(void) ...@@ -50,9 +50,10 @@ static int hdmi_runtime_get(void)
DSSDBG("hdmi_runtime_get\n"); DSSDBG("hdmi_runtime_get\n");
r = pm_runtime_get_sync(&hdmi.pdev->dev); r = pm_runtime_get_sync(&hdmi.pdev->dev);
WARN_ON(r < 0); if (WARN_ON(r < 0)) {
if (r < 0) pm_runtime_put_sync(&hdmi.pdev->dev);
return r; return r;
}
return 0; return 0;
} }
......
...@@ -54,9 +54,10 @@ static int hdmi_runtime_get(void) ...@@ -54,9 +54,10 @@ static int hdmi_runtime_get(void)
DSSDBG("hdmi_runtime_get\n"); DSSDBG("hdmi_runtime_get\n");
r = pm_runtime_get_sync(&hdmi.pdev->dev); r = pm_runtime_get_sync(&hdmi.pdev->dev);
WARN_ON(r < 0); if (WARN_ON(r < 0)) {
if (r < 0) pm_runtime_put_sync(&hdmi.pdev->dev);
return r; return r;
}
return 0; return 0;
} }
......
...@@ -402,8 +402,11 @@ static int venc_runtime_get(void) ...@@ -402,8 +402,11 @@ static int venc_runtime_get(void)
DSSDBG("venc_runtime_get\n"); DSSDBG("venc_runtime_get\n");
r = pm_runtime_get_sync(&venc.pdev->dev); r = pm_runtime_get_sync(&venc.pdev->dev);
WARN_ON(r < 0); if (WARN_ON(r < 0)) {
return r < 0 ? r : 0; pm_runtime_put_sync(&venc.pdev->dev);
return r;
}
return 0;
} }
static void venc_runtime_put(void) static void venc_runtime_put(void)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment