linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Niklas Cassel <niklas.cassel@linaro.org>
To: Ulf Hansson <ulf.hansson@linaro.org>
Cc: Rajendra Nayak <rnayak@codeaurora.org>,
	linux-pm@vger.kernel.org,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Kevin Hilman <khilman@kernel.org>,
	"Rafael J . Wysocki" <rjw@rjwysocki.net>,
	linux-kernel@vger.kernel.org, Jon Hunter <jonathanh@nvidia.com>,
	Viresh Kumar <viresh.kumar@linaro.org>,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 1/3] PM / Domains: Don't kfree() the virtual device in the error path
Date: Wed, 24 Apr 2019 13:28:18 +0200	[thread overview]
Message-ID: <20190424112818.GA30710@centauri.ideon.se> (raw)
In-Reply-To: <20190418102757.1246-2-ulf.hansson@linaro.org>

On Thu, Apr 18, 2019 at 12:27:55PM +0200, Ulf Hansson wrote:
> It's not correct to call kfree(dev) when device_register(dev) has failed.
> Fix this by calling put_device(dev) instead.
> 
> Fixes: 3c095f32a92b ("PM / Domains: Add support for multi PM domains per device to genpd")
> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
> ---
>  drivers/base/power/domain.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
> index ecac03dcc9b2..7fec69aebf46 100644
> --- a/drivers/base/power/domain.c
> +++ b/drivers/base/power/domain.c
> @@ -2528,7 +2528,7 @@ struct device *genpd_dev_pm_attach_by_id(struct device *dev,
>  
>  	ret = device_register(virt_dev);
>  	if (ret) {
> -		kfree(virt_dev);
> +		put_device(virt_dev);
>  		return ERR_PTR(ret);
>  	}
>  
> -- 
> 2.17.1
> 

Acked-by: Niklas Cassel <niklas.cassel@linaro.org>

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2019-04-24 11:28 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-18 10:27 [PATCH 0/3] PM / Domains: Improve support for multi PM domains Ulf Hansson
2019-04-18 10:27 ` [PATCH 1/3] PM / Domains: Don't kfree() the virtual device in the error path Ulf Hansson
2019-04-22  8:27   ` Viresh Kumar
2019-04-24 11:28   ` Niklas Cassel [this message]
2019-04-18 10:27 ` [PATCH 2/3] PM / Domains: Allow OF lookup for multi PM domain case from ->attach_dev() Ulf Hansson
2019-04-22  8:29   ` Viresh Kumar
2019-04-24 11:28   ` Niklas Cassel
2019-04-18 10:27 ` [PATCH 3/3] PM / Domains: Enable genpd_dev_pm_attach_by_id|name() for single PM domain Ulf Hansson
2019-04-22  8:31   ` Viresh Kumar
2019-04-24 11:28   ` Niklas Cassel
2019-05-01 10:25 ` [PATCH 0/3] PM / Domains: Improve support for multi PM domains Rafael J. Wysocki

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=20190424112818.GA30710@centauri.ideon.se \
    --to=niklas.cassel@linaro.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jonathanh@nvidia.com \
    --cc=khilman@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rjw@rjwysocki.net \
    --cc=rnayak@codeaurora.org \
    --cc=ulf.hansson@linaro.org \
    --cc=viresh.kumar@linaro.org \
    /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).