linux-hwmon.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Aditya Pakki <pakki001@umn.edu>
To: pakki001@umn.edu
Cc: kjlu@umn.edu, wu000273@umn.edu, Jean Delvare <jdelvare@suse.com>,
	Guenter Roeck <linux@roeck-us.net>,
	linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] hwmon: (ina3221) Fix reference count leak in ina3221_write_enable
Date: Sat, 13 Jun 2020 22:38:03 -0500	[thread overview]
Message-ID: <20200614033803.129922-1-pakki001@umn.edu> (raw)

ina3221_write_enable() calls pm_runtime_get_sync() that increments
the reference counter. In case of failure, decrement the reference
count and return the error.

Signed-off-by: Aditya Pakki <pakki001@umn.edu>
---
 drivers/hwmon/ina3221.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/hwmon/ina3221.c b/drivers/hwmon/ina3221.c
index f335d0cb0c77..9a3b46160de1 100644
--- a/drivers/hwmon/ina3221.c
+++ b/drivers/hwmon/ina3221.c
@@ -492,6 +492,7 @@ static int ina3221_write_enable(struct device *dev, int channel, bool enable)
 		ret = pm_runtime_get_sync(ina->pm_dev);
 		if (ret < 0) {
 			dev_err(dev, "Failed to get PM runtime\n");
+			pm_runtime_put_sync(ina->pm_dev);
 			return ret;
 		}
 	}
-- 
2.25.1


             reply	other threads:[~2020-06-14  3:38 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-14  3:38 Aditya Pakki [this message]
2020-06-14  9:38 ` [PATCH] hwmon: (ina3221) Fix reference count leak in ina3221_write_enable Guenter Roeck

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=20200614033803.129922-1-pakki001@umn.edu \
    --to=pakki001@umn.edu \
    --cc=jdelvare@suse.com \
    --cc=kjlu@umn.edu \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=wu000273@umn.edu \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).