]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
fbdev: sh_mobile_hdmi: Use devm_kzalloc()
authorSangjung Woo <sangjung.woo@samsung.com>
Thu, 3 Oct 2013 14:04:27 +0000 (23:04 +0900)
committerTomi Valkeinen <tomi.valkeinen@ti.com>
Wed, 9 Oct 2013 09:35:43 +0000 (12:35 +0300)
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>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
drivers/video/sh_mobile_hdmi.c

index 45417fa9749ba15852767ce6cf65fdcebf2af68c..5e2845b9f3a8b2da1c09cc24eaee526223648750 100644 (file)
@@ -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;
 }