]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
drm/tilcdc: panel: Use devm_kzalloc to simplify the error path
authorEzequiel Garcia <ezequiel@vanguardiasur.com.ar>
Tue, 2 Sep 2014 12:51:19 +0000 (09:51 -0300)
committerDave Airlie <airlied@redhat.com>
Wed, 17 Sep 2014 00:55:05 +0000 (10:55 +1000)
Using the managed variant to allocate the resource makes the code simpler
and less error-prone.

Tested-by: Darren Etheridge <detheridge@ti.com>
Tested-by: Johannes Pointner <johannes.pointner@br-automation.com>
Signed-off-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
Signed-off-by: Dave Airlie <airlied@redhat.com>
drivers/gpu/drm/tilcdc/tilcdc_panel.c

index 4b36e68158b2a4d3896c48d0d09377da1b88031f..c716c128ded26c94e5e55344468047cc84afc884 100644 (file)
@@ -354,7 +354,7 @@ static int panel_probe(struct platform_device *pdev)
                return -ENXIO;
        }
 
-       panel_mod = kzalloc(sizeof(*panel_mod), GFP_KERNEL);
+       panel_mod = devm_kzalloc(&pdev->dev, sizeof(*panel_mod), GFP_KERNEL);
        if (!panel_mod)
                return -ENOMEM;
 
@@ -391,7 +391,6 @@ fail_timings:
        display_timings_release(panel_mod->timings);
 
 fail_free:
-       kfree(panel_mod);
        tilcdc_module_cleanup(mod);
        return ret;
 }
@@ -405,7 +404,6 @@ static int panel_remove(struct platform_device *pdev)
 
        tilcdc_module_cleanup(mod);
        kfree(panel_mod->info);
-       kfree(panel_mod);
 
        return 0;
 }