All of lore.kernel.org
 help / color / mirror / Atom feed
From: wu000273@umn.edu
To: kjlu@umn.edu
Cc: wu000273@umn.edu, Todor Tomov <todor.too@gmail.com>,
	Andy Gross <agross@kernel.org>,
	Bjorn Andersson <bjorn.andersson@linaro.org>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Hans Verkuil <hansverk@cisco.com>,
	linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH] media: camss: Fix a reference count leak.
Date: Sat, 13 Jun 2020 18:34:00 -0500	[thread overview]
Message-ID: <20200613233400.20600-1-wu000273@umn.edu> (raw)

From: Qiushi Wu <wu000273@umn.edu>

Calling pm_runtime_get_sync increments the counter even in case of
failure, causing incorrect ref count if pm_runtime_put_sync is not
called in error handling paths. Thus replace the jump target
"error_pm_runtime_get" by "err_clocks".

Fixes: 02afa816dbbf ("media: camss: Add basic runtime PM support")
Signed-off-by: Qiushi Wu <wu000273@umn.edu>
---
 drivers/media/platform/qcom/camss/camss-vfe.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/media/platform/qcom/camss/camss-vfe.c b/drivers/media/platform/qcom/camss/camss-vfe.c
index a8c542fa647d..1e7f23538af6 100644
--- a/drivers/media/platform/qcom/camss/camss-vfe.c
+++ b/drivers/media/platform/qcom/camss/camss-vfe.c
@@ -1261,7 +1261,7 @@ static int vfe_get(struct vfe_device *vfe)
 
 		ret = pm_runtime_get_sync(vfe->camss->dev);
 		if (ret < 0)
-			goto error_pm_runtime_get;
+			goto error_clocks;
 
 		ret = vfe_set_clock_rates(vfe);
 		if (ret < 0)
@@ -1295,8 +1295,6 @@ static int vfe_get(struct vfe_device *vfe)
 
 error_clocks:
 	pm_runtime_put_sync(vfe->camss->dev);
-
-error_pm_runtime_get:
 	camss_pm_domain_off(vfe->camss, vfe->id);
 
 error_pm_domain:
-- 
2.17.1


             reply	other threads:[~2020-06-13 23:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-13 23:34 wu000273 [this message]
  -- strict thread matches above, loose matches on Subject: below --
2020-06-13 23:27 [PATCH] media: camss: Fix a reference count leak wu000273

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200613233400.20600-1-wu000273@umn.edu \
    --to=wu000273@umn.edu \
    --cc=agross@kernel.org \
    --cc=bjorn.andersson@linaro.org \
    --cc=hansverk@cisco.com \
    --cc=kjlu@umn.edu \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=todor.too@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.