video: mmp: drop needless devm cleanup
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>hifive-unleashed-5.1
parent
633358e9ff
commit
fb8a15079a
|
@ -514,7 +514,7 @@ static int mmphw_probe(struct platform_device *pdev)
|
||||||
if (IS_ERR(ctrl->clk)) {
|
if (IS_ERR(ctrl->clk)) {
|
||||||
dev_err(ctrl->dev, "unable to get clk %s\n", mi->clk_name);
|
dev_err(ctrl->dev, "unable to get clk %s\n", mi->clk_name);
|
||||||
ret = -ENOENT;
|
ret = -ENOENT;
|
||||||
goto failed_get_clk;
|
goto failed;
|
||||||
}
|
}
|
||||||
clk_prepare_enable(ctrl->clk);
|
clk_prepare_enable(ctrl->clk);
|
||||||
|
|
||||||
|
@ -551,21 +551,8 @@ failed_path_init:
|
||||||
path_deinit(path_plat);
|
path_deinit(path_plat);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ctrl->clk) {
|
clk_disable_unprepare(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);
|
|
||||||
failed:
|
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");
|
dev_err(&pdev->dev, "device init failed\n");
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
Loading…
Reference in New Issue