diff mbox

watchdog: da9052: Fix invalid free of devm_ allocated data

Message ID 1353559384-26570-1-git-send-email-tushar.behera@linaro.org
State Accepted
Commit 0360dffedd7bad92f174b2ce5e69e960451d2b59
Headers show

Commit Message

Tushar Behera Nov. 22, 2012, 4:43 a.m. UTC
It is not required to free devm_ allocated data. Since kref_put
needs a valid release function, da9052_wdt_release_resources()
is not deleted.

Fixes following warning.
drivers/watchdog/da9052_wdt.c:59:1-6: WARNING: invalid free of
devm_ allocated data

Signed-off-by: Tushar Behera <tushar.behera@linaro.org>
---
 drivers/watchdog/da9052_wdt.c |    4 ----
 1 files changed, 0 insertions(+), 4 deletions(-)

Comments

Shubhrajyoti Datta Nov. 26, 2012, 1:01 p.m. UTC | #1
On Thu, Nov 22, 2012 at 10:13 AM, Tushar Behera
<tushar.behera@linaro.org> wrote:
> It is not required to free devm_ allocated data. Since kref_put
> needs a valid release function, da9052_wdt_release_resources()
> is not deleted.
>
> Fixes following warning.
> drivers/watchdog/da9052_wdt.c:59:1-6: WARNING: invalid free of
> devm_ allocated data
>
> Signed-off-by: Tushar Behera <tushar.behera@linaro.org>
> ---
>  drivers/watchdog/da9052_wdt.c |    4 ----
>  1 files changed, 0 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/watchdog/da9052_wdt.c b/drivers/watchdog/da9052_wdt.c
> index f7abbae..20071de 100644
> --- a/drivers/watchdog/da9052_wdt.c
> +++ b/drivers/watchdog/da9052_wdt.c
> @@ -53,10 +53,6 @@ static const struct {
>
>  static void da9052_wdt_release_resources(struct kref *r)
>  {
> -       struct da9052_wdt_data *driver_data =
> -               container_of(r, struct da9052_wdt_data, kref);
> -
> -       kfree(driver_data);

However now the function will be empty right?


>  }
>
>  static int da9052_wdt_set_timeout(struct watchdog_device *wdt_dev,
> --
> 1.7.4.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
Tushar Behera Nov. 27, 2012, 5:29 a.m. UTC | #2
On 11/26/2012 06:31 PM, Shubhrajyoti Datta wrote:
> On Thu, Nov 22, 2012 at 10:13 AM, Tushar Behera
> <tushar.behera@linaro.org> wrote:
>> It is not required to free devm_ allocated data. Since kref_put
>> needs a valid release function, da9052_wdt_release_resources()
>> is not deleted.
>>
>> Fixes following warning.
>> drivers/watchdog/da9052_wdt.c:59:1-6: WARNING: invalid free of
>> devm_ allocated data
>>
>> Signed-off-by: Tushar Behera <tushar.behera@linaro.org>
>> ---
>>  drivers/watchdog/da9052_wdt.c |    4 ----
>>  1 files changed, 0 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/watchdog/da9052_wdt.c b/drivers/watchdog/da9052_wdt.c
>> index f7abbae..20071de 100644
>> --- a/drivers/watchdog/da9052_wdt.c
>> +++ b/drivers/watchdog/da9052_wdt.c
>> @@ -53,10 +53,6 @@ static const struct {
>>
>>  static void da9052_wdt_release_resources(struct kref *r)
>>  {
>> -       struct da9052_wdt_data *driver_data =
>> -               container_of(r, struct da9052_wdt_data, kref);
>> -
>> -       kfree(driver_data);
> 
> However now the function will be empty right?
> 
> 

Yes, the function would be empty now. It is kept just to avoid the
run-time warning.

>>  }
>>
>>  static int da9052_wdt_set_timeout(struct watchdog_device *wdt_dev,
>> --
>> 1.7.4.1
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>> Please read the FAQ at  http://www.tux.org/lkml/
diff mbox

Patch

diff --git a/drivers/watchdog/da9052_wdt.c b/drivers/watchdog/da9052_wdt.c
index f7abbae..20071de 100644
--- a/drivers/watchdog/da9052_wdt.c
+++ b/drivers/watchdog/da9052_wdt.c
@@ -53,10 +53,6 @@  static const struct {
 
 static void da9052_wdt_release_resources(struct kref *r)
 {
-	struct da9052_wdt_data *driver_data =
-		container_of(r, struct da9052_wdt_data, kref);
-
-	kfree(driver_data);
 }
 
 static int da9052_wdt_set_timeout(struct watchdog_device *wdt_dev,