linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pavel Machek <pavel@ucw.cz>
To: Johan Hovold <johan@kernel.org>
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>,
	Len Brown <len.brown@intel.com>,
	linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] PM / sleep: fix device reference leak in test_suspend
Date: Wed, 2 Nov 2016 09:52:30 +0100	[thread overview]
Message-ID: <20161102085230.GB23350@amd> (raw)
In-Reply-To: <1477997396-29476-1-git-send-email-johan@kernel.org>

[-- Attachment #1: Type: text/plain, Size: 1097 bytes --]

On Tue 2016-11-01 11:49:56, Johan Hovold wrote:
> Make sure to drop the reference taken by class_find_device() after
> opening the rtc device.
> 
> Fixes: 77437fd4e61f ("pm: boot time suspend selftest")
> Signed-off-by: Johan Hovold <johan@kernel.org>

Acked-by: Pavel Machek <pavel@ucw.cz>

> ---
>  kernel/power/suspend_test.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/kernel/power/suspend_test.c b/kernel/power/suspend_test.c
> index 084452e34a12..bdff5ed57f10 100644
> --- a/kernel/power/suspend_test.c
> +++ b/kernel/power/suspend_test.c
> @@ -203,8 +203,10 @@ static int __init test_suspend(void)
>  
>  	/* RTCs have initialized by now too ... can we use one? */
>  	dev = class_find_device(rtc_class, NULL, NULL, has_wakealarm);
> -	if (dev)
> +	if (dev) {
>  		rtc = rtc_class_open(dev_name(dev));
> +		put_device(dev);
> +	}
>  	if (!rtc) {
>  		printk(warn_no_rtc);
>  		return 0;

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

      reply	other threads:[~2016-11-02  8:52 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-01 10:49 [PATCH] PM / sleep: fix device reference leak in test_suspend Johan Hovold
2016-11-02  8:52 ` Pavel Machek [this message]

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=20161102085230.GB23350@amd \
    --to=pavel@ucw.cz \
    --cc=johan@kernel.org \
    --cc=len.brown@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rjw@rjwysocki.net \
    /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).