Skip to content

Commit

Permalink
drm/tilcdc: panel: Use devm_kzalloc to simplify the error path
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Ezequiel Garcia authored and Dave Airlie committed Sep 17, 2014
1 parent e3a9b04 commit 971645d
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions drivers/gpu/drm/tilcdc/tilcdc_panel.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -391,7 +391,6 @@ static int panel_probe(struct platform_device *pdev)
display_timings_release(panel_mod->timings);

fail_free:
kfree(panel_mod);
tilcdc_module_cleanup(mod);
return ret;
}
Expand All @@ -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;
}
Expand Down

0 comments on commit 971645d

Please sign in to comment.