Skip to content

Commit

Permalink
video: mmp: drop needless devm cleanup
Browse files Browse the repository at this point in the history
The nice thing about devm_* is that the driver doesn't need to free the
resources but the driver core takes care about that. This also
simplifies the error path quite a bit and removes the wrong check for a
clock pointer being NULL.

Russell King - ARM Linux <linux@arm.linux.org.uk>:
"And this patch also fixes the above: disabling/unpreparing _after_ putting
the thing - which was quite silly... :)"

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
  • Loading branch information
Uwe Kleine-König authored and Tomi Valkeinen committed Sep 26, 2013
1 parent 633358e commit fb8a150
Showing 1 changed file with 2 additions and 15 deletions.
17 changes: 2 additions & 15 deletions drivers/video/mmp/hw/mmp_ctrl.c
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@ static int mmphw_probe(struct platform_device *pdev)
if (IS_ERR(ctrl->clk)) {
dev_err(ctrl->dev, "unable to get clk %s\n", mi->clk_name);
ret = -ENOENT;
goto failed_get_clk;
goto failed;
}
clk_prepare_enable(ctrl->clk);

Expand Down Expand Up @@ -551,21 +551,8 @@ static int mmphw_probe(struct platform_device *pdev)
path_deinit(path_plat);
}

if (ctrl->clk) {
devm_clk_put(ctrl->dev, ctrl->clk);
clk_disable_unprepare(ctrl->clk);
}
failed_get_clk:
devm_free_irq(ctrl->dev, ctrl->irq, ctrl);
clk_disable_unprepare(ctrl->clk);
failed:
if (ctrl) {
if (ctrl->reg_base)
devm_iounmap(ctrl->dev, ctrl->reg_base);
devm_release_mem_region(ctrl->dev, res->start,
resource_size(res));
devm_kfree(ctrl->dev, ctrl);
}

dev_err(&pdev->dev, "device init failed\n");

return ret;
Expand Down

0 comments on commit fb8a150

Please sign in to comment.