Commit 971645d1 authored by Ezequiel Garcia's avatar Ezequiel Garcia Committed by Dave Airlie

drm/tilcdc: panel: Use devm_kzalloc to simplify the error path

Using the managed variant to allocate the resource makes the code simpler
and less error-prone.
Tested-by: default avatarDarren Etheridge <detheridge@ti.com>
Tested-by: default avatarJohannes Pointner <johannes.pointner@br-automation.com>
Signed-off-by: default avatarEzequiel Garcia <ezequiel@vanguardiasur.com.ar>
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
parent e3a9b046
...@@ -354,7 +354,7 @@ static int panel_probe(struct platform_device *pdev) ...@@ -354,7 +354,7 @@ static int panel_probe(struct platform_device *pdev)
return -ENXIO; return -ENXIO;
} }
panel_mod = kzalloc(sizeof(*panel_mod), GFP_KERNEL); panel_mod = devm_kzalloc(&pdev->dev, sizeof(*panel_mod), GFP_KERNEL);
if (!panel_mod) if (!panel_mod)
return -ENOMEM; return -ENOMEM;
...@@ -391,7 +391,6 @@ static int panel_probe(struct platform_device *pdev) ...@@ -391,7 +391,6 @@ static int panel_probe(struct platform_device *pdev)
display_timings_release(panel_mod->timings); display_timings_release(panel_mod->timings);
fail_free: fail_free:
kfree(panel_mod);
tilcdc_module_cleanup(mod); tilcdc_module_cleanup(mod);
return ret; return ret;
} }
...@@ -405,7 +404,6 @@ static int panel_remove(struct platform_device *pdev) ...@@ -405,7 +404,6 @@ static int panel_remove(struct platform_device *pdev)
tilcdc_module_cleanup(mod); tilcdc_module_cleanup(mod);
kfree(panel_mod->info); kfree(panel_mod->info);
kfree(panel_mod);
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