lkml.org 
[lkml]   [2020]   [Jun]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] drm/bridge: fix reference count leaks due to pm_runtime_get_sync()
Date
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: Aditya Pakki <pakki001@umn.edu>
---
drivers/gpu/drm/bridge/cdns-dsi.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/bridge/cdns-dsi.c b/drivers/gpu/drm/bridge/cdns-dsi.c
index 69c3892caee5..583cb8547106 100644
--- a/drivers/gpu/drm/bridge/cdns-dsi.c
+++ b/drivers/gpu/drm/bridge/cdns-dsi.c
@@ -788,8 +788,10 @@ static void cdns_dsi_bridge_enable(struct drm_bridge *bridge)
u32 tmp, reg_wakeup, div;
int nlanes;

- if (WARN_ON(pm_runtime_get_sync(dsi->base.dev) < 0))
+ if (WARN_ON(pm_runtime_get_sync(dsi->base.dev) < 0)) {
+ pm_runtime_put(dsi->base.dev);
return;
+ }

mode = &bridge->encoder->crtc->state->adjusted_mode;
nlanes = output->dev->lanes;
@@ -1028,8 +1030,10 @@ static ssize_t cdns_dsi_transfer(struct mipi_dsi_host *host,
int ret, i, tx_len, rx_len;

ret = pm_runtime_get_sync(host->dev);
- if (ret < 0)
+ if (ret < 0) {
+ pm_runtime_put(host->dev);
return ret;
+ }

cdns_dsi_init_link(dsi);

--
2.25.1
\
 
 \ /
  Last update: 2020-06-14 04:40    [W:0.289 / U:0.128 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site