* [PATCH] fbdev: sh_mobile_hdmi: Use devm_kzalloc()
@ 2013-10-03 14:04 Sangjung Woo
2013-10-03 16:56 ` Laurent Pinchart
2013-10-09 8:37 ` Tomi Valkeinen
0 siblings, 2 replies; 3+ messages in thread
From: Sangjung Woo @ 2013-10-03 14:04 UTC (permalink / raw)
To: Andrew Morton, Tomi Valkeinen
Cc: Laurent Pinchart, linux-kernel, Sangjung Woo
Use devm_kzalloc() instead of kzalloc() in order to be free
automatically. This makes cleanup paths more simple.
Signed-off-by: Sangjung Woo <sangjung.woo@samsung.com>
---
drivers/video/sh_mobile_hdmi.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/drivers/video/sh_mobile_hdmi.c b/drivers/video/sh_mobile_hdmi.c
index bfe4728..64bd0bf 100644
--- a/drivers/video/sh_mobile_hdmi.c
+++ b/drivers/video/sh_mobile_hdmi.c
@@ -1290,7 +1290,7 @@ static int __init sh_hdmi_probe(struct platform_device *pdev)
}
}
- hdmi = kzalloc(sizeof(*hdmi), GFP_KERNEL);
+ hdmi = devm_kzalloc(&pdev->dev, sizeof(*hdmi), GFP_KERNEL);
if (!hdmi) {
dev_err(&pdev->dev, "Cannot allocate device data\n");
return -ENOMEM;
@@ -1304,7 +1304,7 @@ static int __init sh_hdmi_probe(struct platform_device *pdev)
if (IS_ERR(hdmi->hdmi_clk)) {
ret = PTR_ERR(hdmi->hdmi_clk);
dev_err(&pdev->dev, "Unable to get clock: %d\n", ret);
- goto egetclk;
+ return ret;
}
/* select register access functions */
@@ -1407,8 +1407,6 @@ ereqreg:
clk_disable(hdmi->hdmi_clk);
erate:
clk_put(hdmi->hdmi_clk);
-egetclk:
- kfree(hdmi);
return ret;
}
@@ -1433,7 +1431,6 @@ static int __exit sh_hdmi_remove(struct platform_device *pdev)
iounmap(hdmi->htop1);
iounmap(hdmi->base);
release_mem_region(res->start, resource_size(res));
- kfree(hdmi);
return 0;
}
--
1.7.9.5
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] fbdev: sh_mobile_hdmi: Use devm_kzalloc()
2013-10-03 14:04 [PATCH] fbdev: sh_mobile_hdmi: Use devm_kzalloc() Sangjung Woo
@ 2013-10-03 16:56 ` Laurent Pinchart
2013-10-09 8:37 ` Tomi Valkeinen
1 sibling, 0 replies; 3+ messages in thread
From: Laurent Pinchart @ 2013-10-03 16:56 UTC (permalink / raw)
To: Sangjung Woo; +Cc: Andrew Morton, Tomi Valkeinen, linux-kernel
Hi Sangjung,
Thank you for the patch.
On Thursday 03 October 2013 23:04:27 Sangjung Woo wrote:
> Use devm_kzalloc() instead of kzalloc() in order to be free
> automatically. This makes cleanup paths more simple.
>
> Signed-off-by: Sangjung Woo <sangjung.woo@samsung.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tomi, could you please pick it up ?
> ---
> drivers/video/sh_mobile_hdmi.c | 7 ++-----
> 1 file changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/video/sh_mobile_hdmi.c b/drivers/video/sh_mobile_hdmi.c
> index bfe4728..64bd0bf 100644
> --- a/drivers/video/sh_mobile_hdmi.c
> +++ b/drivers/video/sh_mobile_hdmi.c
> @@ -1290,7 +1290,7 @@ static int __init sh_hdmi_probe(struct platform_device
> *pdev) }
> }
>
> - hdmi = kzalloc(sizeof(*hdmi), GFP_KERNEL);
> + hdmi = devm_kzalloc(&pdev->dev, sizeof(*hdmi), GFP_KERNEL);
> if (!hdmi) {
> dev_err(&pdev->dev, "Cannot allocate device data\n");
> return -ENOMEM;
> @@ -1304,7 +1304,7 @@ static int __init sh_hdmi_probe(struct platform_device
> *pdev) if (IS_ERR(hdmi->hdmi_clk)) {
> ret = PTR_ERR(hdmi->hdmi_clk);
> dev_err(&pdev->dev, "Unable to get clock: %d\n", ret);
> - goto egetclk;
> + return ret;
> }
>
> /* select register access functions */
> @@ -1407,8 +1407,6 @@ ereqreg:
> clk_disable(hdmi->hdmi_clk);
> erate:
> clk_put(hdmi->hdmi_clk);
> -egetclk:
> - kfree(hdmi);
>
> return ret;
> }
> @@ -1433,7 +1431,6 @@ static int __exit sh_hdmi_remove(struct
> platform_device *pdev) iounmap(hdmi->htop1);
> iounmap(hdmi->base);
> release_mem_region(res->start, resource_size(res));
> - kfree(hdmi);
>
> return 0;
> }
--
Regards,
Laurent Pinchart
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] fbdev: sh_mobile_hdmi: Use devm_kzalloc()
2013-10-03 14:04 [PATCH] fbdev: sh_mobile_hdmi: Use devm_kzalloc() Sangjung Woo
2013-10-03 16:56 ` Laurent Pinchart
@ 2013-10-09 8:37 ` Tomi Valkeinen
1 sibling, 0 replies; 3+ messages in thread
From: Tomi Valkeinen @ 2013-10-09 8:37 UTC (permalink / raw)
To: Sangjung Woo; +Cc: Andrew Morton, Laurent Pinchart, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 373 bytes --]
On 03/10/13 17:04, Sangjung Woo wrote:
> Use devm_kzalloc() instead of kzalloc() in order to be free
> automatically. This makes cleanup paths more simple.
>
> Signed-off-by: Sangjung Woo <sangjung.woo@samsung.com>
> ---
> drivers/video/sh_mobile_hdmi.c | 7 ++-----
> 1 file changed, 2 insertions(+), 5 deletions(-)
Thanks, queued for 3.13.
Tomi
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 901 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-10-09 8:37 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-03 14:04 [PATCH] fbdev: sh_mobile_hdmi: Use devm_kzalloc() Sangjung Woo
2013-10-03 16:56 ` Laurent Pinchart
2013-10-09 8:37 ` Tomi Valkeinen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox