[<prev] [next>] [day] [month] [year] [list]
Message-id: <361552041.487551443751886669.JavaMail.weblogic@epmlwas01a>
Date: Fri, 02 Oct 2015 02:11:27 +0000 (GMT)
From: MyungJoo Ham <myungjoo.ham@...sung.com>
To: Geliang Tang <geliangtang@....com>,
박경민 <kyungmin.park@...sung.com>
Cc: "linux-pm@...r.kernel.org" <linux-pm@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] PM / devfreq: fix double kfree
> 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@....com>
Thank you for pointing out that put_device() will eventually call kfree anyway.
Signed-off-by: MyungJoo Ham <myungjoo.ham@...sung.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
Powered by blists - more mailing lists