* Re: [PATCH] PM / devfreq: fix double kfree
@ 2015-10-02 2:11 MyungJoo Ham
0 siblings, 0 replies; 2+ messages in thread
From: MyungJoo Ham @ 2015-10-02 2:11 UTC (permalink / raw)
To: Geliang Tang, 박경민
Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org
> 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
^ permalink raw reply [flat|nested] 2+ messages in thread
* [PATCH] PM / devfreq: fix double kfree
@ 2015-10-01 14:18 Geliang Tang
0 siblings, 0 replies; 2+ messages in thread
From: Geliang Tang @ 2015-10-01 14:18 UTC (permalink / raw)
To: MyungJoo Ham, Kyungmin Park; +Cc: Geliang Tang, linux-pm, linux-kernel
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>
---
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-10-02 2:11 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-02 2:11 [PATCH] PM / devfreq: fix double kfree MyungJoo Ham
-- strict thread matches above, loose matches on Subject: below --
2015-10-01 14:18 Geliang Tang
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).