Commit 4d26ec5d authored by Sangjung Woo's avatar Sangjung Woo Committed by Tomi Valkeinen

fbdev: sh_mobile_hdmi: Use devm_kzalloc()

Use devm_kzalloc() instead of kzalloc() in order to be free
automatically. This makes cleanup paths more simple.
Signed-off-by: default avatarSangjung Woo <sangjung.woo@samsung.com>
Acked-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: default avatarTomi Valkeinen <tomi.valkeinen@ti.com>
parent 55be3108
...@@ -1290,7 +1290,7 @@ static int __init sh_hdmi_probe(struct platform_device *pdev) ...@@ -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) { if (!hdmi) {
dev_err(&pdev->dev, "Cannot allocate device data\n"); dev_err(&pdev->dev, "Cannot allocate device data\n");
return -ENOMEM; return -ENOMEM;
...@@ -1304,7 +1304,7 @@ static int __init sh_hdmi_probe(struct platform_device *pdev) ...@@ -1304,7 +1304,7 @@ static int __init sh_hdmi_probe(struct platform_device *pdev)
if (IS_ERR(hdmi->hdmi_clk)) { if (IS_ERR(hdmi->hdmi_clk)) {
ret = PTR_ERR(hdmi->hdmi_clk); ret = PTR_ERR(hdmi->hdmi_clk);
dev_err(&pdev->dev, "Unable to get clock: %d\n", ret); dev_err(&pdev->dev, "Unable to get clock: %d\n", ret);
goto egetclk; return ret;
} }
/* select register access functions */ /* select register access functions */
...@@ -1407,8 +1407,6 @@ static int __init sh_hdmi_probe(struct platform_device *pdev) ...@@ -1407,8 +1407,6 @@ static int __init sh_hdmi_probe(struct platform_device *pdev)
clk_disable(hdmi->hdmi_clk); clk_disable(hdmi->hdmi_clk);
erate: erate:
clk_put(hdmi->hdmi_clk); clk_put(hdmi->hdmi_clk);
egetclk:
kfree(hdmi);
return ret; return ret;
} }
...@@ -1433,7 +1431,6 @@ static int __exit sh_hdmi_remove(struct platform_device *pdev) ...@@ -1433,7 +1431,6 @@ static int __exit sh_hdmi_remove(struct platform_device *pdev)
iounmap(hdmi->htop1); iounmap(hdmi->htop1);
iounmap(hdmi->base); iounmap(hdmi->base);
release_mem_region(res->start, resource_size(res)); release_mem_region(res->start, resource_size(res));
kfree(hdmi);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment