From: MyungJoo Ham <myungjoo.ham@samsung.com>
To: "Geliang Tang" <geliangtang@163.com>, 박경민 <kyungmin.park@samsung.com>
Cc: "linux-pm@vger.kernel.org" <linux-pm@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] PM / devfreq: fix double kfree
Date: Fri, 02 Oct 2015 02:11:27 +0000 (GMT) [thread overview]
Message-ID: <361552041.487551443751886669.JavaMail.weblogic@epmlwas01a> (raw)
> When device_register() fails, kfree(devfreq) is called already in
> devfreq_dev_release(), hence there is no need to call kfree(devfreq)
> in err_dev again.
>
> Signed-off-by: Geliang Tang <geliangtang@163.com>
Thank you for pointing out that put_device() will eventually call kfree anyway.
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Cheers,
MyungJoo
> ---
> drivers/devfreq/devfreq.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c
> index 3927ed9..9b352da 100644
> --- a/drivers/devfreq/devfreq.c
> +++ b/drivers/devfreq/devfreq.c
> @@ -492,7 +492,7 @@ struct devfreq *devfreq_add_device(struct device *dev,
> if (err) {
> put_device(&devfreq->dev);
> mutex_unlock(&devfreq->lock);
> - goto err_dev;
> + goto err_out;
> }
>
> mutex_unlock(&devfreq->lock);
> @@ -518,7 +518,6 @@ struct devfreq *devfreq_add_device(struct device *dev,
> err_init:
> list_del(&devfreq->node);
> device_unregister(&devfreq->dev);
> -err_dev:
> kfree(devfreq);
> err_out:
> return ERR_PTR(err);
> --
> 2.5.0
next reply other threads:[~2015-10-02 2:11 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-02 2:11 MyungJoo Ham [this message]
-- strict thread matches above, loose matches on Subject: below --
2015-10-01 14:18 [PATCH] PM / devfreq: fix double kfree Geliang Tang
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=361552041.487551443751886669.JavaMail.weblogic@epmlwas01a \
--to=myungjoo.ham@samsung.com \
--cc=geliangtang@163.com \
--cc=kyungmin.park@samsung.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.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).