2012-06-16 13:25:23

by Axel Lin

[permalink] [raw]
Subject: [PATCH] extcon: max8997: Add missing kfree for info->edev in max8997_muic_remove()

extcon_dev_unregister(info->edev) doest not free info->edev, we need to call
kfree(info->edev) here.

Signed-off-by: Axel Lin <[email protected]>
---
drivers/extcon/extcon-max8997.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/extcon/extcon-max8997.c b/drivers/extcon/extcon-max8997.c
index 5ecf176..a4ed30b 100644
--- a/drivers/extcon/extcon-max8997.c
+++ b/drivers/extcon/extcon-max8997.c
@@ -514,6 +514,7 @@ static int __devexit max8997_muic_remove(struct platform_device *pdev)

extcon_dev_unregister(info->edev);

+ kfree(info->edev);
kfree(info);

return 0;
--
1.7.9.5



2012-06-18 02:42:55

by MyungJoo Ham

[permalink] [raw]
Subject: Re: [PATCH] extcon: max8997: Add missing kfree for info->edev in max8997_muic_remove()

> extcon_dev_unregister(info->edev) doest not free info->edev, we need to call
> kfree(info->edev) here.
>
> Signed-off-by: Axel Lin <[email protected]>

The patch is correct.

However, using devm_kzalloc at probe and removing kfree at remove appears to be much better.

Thank you.


Cheers!
MyungJoo.

> ---
> drivers/extcon/extcon-max8997.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/extcon/extcon-max8997.c b/drivers/extcon/extcon-max8997.c
> index 5ecf176..a4ed30b 100644
> --- a/drivers/extcon/extcon-max8997.c
> +++ b/drivers/extcon/extcon-max8997.c
> @@ -514,6 +514,7 @@ static int __devexit max8997_muic_remove(struct platform_device *pdev)
>
> extcon_dev_unregister(info->edev);
>
> + kfree(info->edev);
> kfree(info);
>
> return 0;
> --
> 1.7.9.5
>
------
Sender : Axel Lin<[email protected]>
Date : 2012-06-16 22:25 (GMT+09:00)
Title : [PATCH] extcon: max8997: Add missing kfree for info->edev in max8997_muic_remove()

extcon_dev_unregister(info->edev) doest not free info->edev, we need to call
kfree(info->edev) here.

Signed-off-by: Axel Lin
---
drivers/extcon/extcon-max8997.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/extcon/extcon-max8997.c b/drivers/extcon/extcon-max8997.c
index 5ecf176..a4ed30b 100644
--- a/drivers/extcon/extcon-max8997.c
+++ b/drivers/extcon/extcon-max8997.c
@@ -514,6 +514,7 @@ static int __devexit max8997_muic_remove(struct platform_device *pdev)

extcon_dev_unregister(info->edev);

+ kfree(info->edev);
kfree(info);

return 0;
--
1.7.9.5






--
MyungJoo Ham (?Ը???), PHD
System S/W Lab, S/W Platform Team, Software Center
Samsung Electronics
Cell: +82-10-6714-2858????{.n?+???????+%?????ݶ??w??{.n?+????{??G?????{ay?ʇڙ?,j??f???h?????????z_??(?階?ݢj"???m??????G????????????&???~???iO???z??v?^?m???? ????????I?

2012-06-18 02:54:29

by Axel Lin

[permalink] [raw]
Subject: Re: [PATCH] extcon: max8997: Add missing kfree for info->edev in max8997_muic_remove()

2012/6/18 함명주 <[email protected]>:
>> extcon_dev_unregister(info->edev) doest not free info->edev, we need to call
>> kfree(info->edev) here.
>>
>> Signed-off-by: Axel Lin <[email protected]>
>
> The patch is correct.
>
> However, using devm_kzalloc at probe and removing kfree at remove appears to be much better.
Yes, But I think Greg may prefer this one-linear for 3.5.
And another patch for the devm_kcalloc conversion for 3.6.

Regards,
Axel