diff mbox series

media: bdisp: fix reference count leaks due to pm_runtime_get_sync

Message ID 20200614034936.130872-1-pakki001@umn.edu
State New
Headers show
Series media: bdisp: fix reference count leaks due to pm_runtime_get_sync | expand

Commit Message

Aditya Pakki June 14, 2020, 3:49 a.m. UTC
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/media/platform/sti/bdisp/bdisp-v4l2.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/drivers/media/platform/sti/bdisp/bdisp-v4l2.c b/drivers/media/platform/sti/bdisp/bdisp-v4l2.c
index af2d5eb782ce..098914ca4f68 100644
--- a/drivers/media/platform/sti/bdisp/bdisp-v4l2.c
+++ b/drivers/media/platform/sti/bdisp/bdisp-v4l2.c
@@ -512,6 +512,7 @@  static int bdisp_start_streaming(struct vb2_queue *q, unsigned int count)
 				v4l2_m2m_buf_done(buf, VB2_BUF_STATE_QUEUED);
 		}
 
+		pm_runtime_put(ctx->bdisp_dev->dev);
 		return ret;
 	}
 
@@ -1371,7 +1372,7 @@  static int bdisp_probe(struct platform_device *pdev)
 	ret = pm_runtime_get_sync(dev);
 	if (ret < 0) {
 		dev_err(dev, "failed to set PM\n");
-		goto err_dbg;
+		goto err_pm;
 	}
 
 	/* Filters */