[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAEExFWt3QcdAYuUCbJP8ZAr2nhQ4gt5zcnMJA5bwyw+rvxzNUw@mail.gmail.com>
Date: Sun, 20 Jan 2019 00:08:35 +0800
From: Frank Lee <tiny.windzz@...il.com>
To: cwchoi00@...il.com
Cc: MyungJoo Ham <myungjoo.ham@...sung.com>,
Kyungmin Park <kyungmin.park@...sung.com>,
Chanwoo Choi <cw00.choi@...sung.com>,
Linux PM list <linux-pm@...r.kernel.org>,
linux-kernel <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] PM / devfreq: fix mem leak and missing check of return
value in devfreq_add_device()
> Also, you better to add following codes to free the memory of
> 'devfreq->trans_table' and 'devfreq->time_in_state' because this patch
> handles the memory leak of 'trans_table' and 'time_in_state'
> variables.
Hi Chanwoo:
Isn't that the mem requested by the devm_ API automatically freed when
the device is detached?
So we don't need to pay attention to free these mem.
Thanks,
Yangtao
>
> diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c
> index 0ae3de7..945f5f1 100644
> --- a/drivers/devfreq/devfreq.c
> +++ b/drivers/devfreq/devfreq.c
> @@ -593,6 +593,9 @@ static void devfreq_dev_release(struct device *dev)
> devfreq->profile->exit(devfreq->dev.parent);
>
> mutex_destroy(&devfreq->lock);
> + kfree(devfreq->trans_table);
> + kfree(devfreq->time_in_state);
> kfree(devfreq);
> }
>
> --
> Best Regards,
> Chanwoo Choi
> Samsung Electronics
Powered by blists - more mailing lists