public inbox for linux-hwmon@vger.kernel.org
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: Zhang Qilong <zhangqilong3@huawei.com>
Cc: jdelvare@suse.com, linux-hwmon@vger.kernel.org
Subject: Re: [PATCH] hwmon: (ina3221) Fix PM usage counter unbalance in ina3221_write_enable
Date: Sat, 28 Nov 2020 19:04:22 -0800	[thread overview]
Message-ID: <20201129030422.GA96772@roeck-us.net> (raw)
In-Reply-To: <20201123102000.3864999-1-zhangqilong3@huawei.com>

On Mon, Nov 23, 2020 at 06:20:00PM +0800, Zhang Qilong wrote:
> pm_runtime_get_sync will increment pm usage counter
> even it failed. Forgetting to putting operation will
> result in reference leak here. We fix it by replacing
> it with pm_runtime_resume_and_get to keep usage counter
> balanced.
> 
Turns out this function doesn't exist in the mainline kernel,
meaning it can not be used to fix a patch in the mainline kernel.
I dropped this patch from my queue.

Guenter

> Fixes: 323aeb0eb5d9a ("hwmon: (ina3221) Add PM runtime support")
> Signed-off-by: Zhang Qilong <zhangqilong3@huawei.com>
> ---
>  drivers/hwmon/ina3221.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/hwmon/ina3221.c b/drivers/hwmon/ina3221.c
> index 72cfdc007e60..d80bd3efcd6d 100644
> --- a/drivers/hwmon/ina3221.c
> +++ b/drivers/hwmon/ina3221.c
> @@ -489,7 +489,7 @@ static int ina3221_write_enable(struct device *dev, int channel, bool enable)
>  
>  	/* For enabling routine, increase refcount and resume() at first */
>  	if (enable) {
> -		ret = pm_runtime_get_sync(ina->pm_dev);
> +		ret = pm_runtime_resume_and_get(ina->pm_dev);
>  		if (ret < 0) {
>  			dev_err(dev, "Failed to get PM runtime\n");
>  			return ret;

  parent reply	other threads:[~2020-11-29  3:05 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-23 10:20 [PATCH] hwmon: (ina3221) Fix PM usage counter unbalance in ina3221_write_enable Zhang Qilong
2020-11-25 14:41 ` Guenter Roeck
2020-11-29  3:04 ` Guenter Roeck [this message]
2020-12-02 14:27   ` 答复: " zhangqilong

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=20201129030422.GA96772@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=jdelvare@suse.com \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=zhangqilong3@huawei.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox