Commit fce064cb authored by Jani Nikula's avatar Jani Nikula Committed by Tomi Valkeinen

OMAP: DSS2: Fix omap_dss_probe() error path

Perform graceful cleanup on errors instead of just bailing out.
Signed-off-by: default avatarJani Nikula <ext-jani.1.nikula@nokia.com>
Tested-by: default avatarKevin Hilman <khilman@deeprootsystems.com>
Signed-off-by: default avatarTomi Valkeinen <tomi.valkeinen@nokia.com>
parent 368a148e
...@@ -507,7 +507,7 @@ static int omap_dss_probe(struct platform_device *pdev) ...@@ -507,7 +507,7 @@ static int omap_dss_probe(struct platform_device *pdev)
r = dss_get_clocks(); r = dss_get_clocks();
if (r) if (r)
goto fail0; goto err_clocks;
dss_clk_enable_all_no_ctx(); dss_clk_enable_all_no_ctx();
...@@ -523,57 +523,64 @@ static int omap_dss_probe(struct platform_device *pdev) ...@@ -523,57 +523,64 @@ static int omap_dss_probe(struct platform_device *pdev)
r = dss_init(skip_init); r = dss_init(skip_init);
if (r) { if (r) {
DSSERR("Failed to initialize DSS\n"); DSSERR("Failed to initialize DSS\n");
goto fail0; goto err_dss;
} }
r = rfbi_init(); r = rfbi_init();
if (r) { if (r) {
DSSERR("Failed to initialize rfbi\n"); DSSERR("Failed to initialize rfbi\n");
goto fail0; goto err_rfbi;
} }
r = dpi_init(pdev); r = dpi_init(pdev);
if (r) { if (r) {
DSSERR("Failed to initialize dpi\n"); DSSERR("Failed to initialize dpi\n");
goto fail0; goto err_dpi;
} }
r = dispc_init(); r = dispc_init();
if (r) { if (r) {
DSSERR("Failed to initialize dispc\n"); DSSERR("Failed to initialize dispc\n");
goto fail0; goto err_dispc;
} }
r = venc_init(pdev); r = venc_init(pdev);
if (r) { if (r) {
DSSERR("Failed to initialize venc\n"); DSSERR("Failed to initialize venc\n");
goto fail0; goto err_venc;
} }
if (cpu_is_omap34xx()) { if (cpu_is_omap34xx()) {
r = sdi_init(skip_init); r = sdi_init(skip_init);
if (r) { if (r) {
DSSERR("Failed to initialize SDI\n"); DSSERR("Failed to initialize SDI\n");
goto fail0; goto err_sdi;
} }
r = dsi_init(pdev); r = dsi_init(pdev);
if (r) { if (r) {
DSSERR("Failed to initialize DSI\n"); DSSERR("Failed to initialize DSI\n");
goto fail0; goto err_dsi;
} }
} }
r = dss_initialize_debugfs(); r = dss_initialize_debugfs();
if (r) if (r)
goto fail0; goto err_debugfs;
for (i = 0; i < pdata->num_devices; ++i) { for (i = 0; i < pdata->num_devices; ++i) {
struct omap_dss_device *dssdev = pdata->devices[i]; struct omap_dss_device *dssdev = pdata->devices[i];
r = omap_dss_register_device(dssdev); r = omap_dss_register_device(dssdev);
if (r) if (r) {
DSSERR("device reg failed %d\n", i); DSSERR("device %d %s register failed %d\n", i,
dssdev->name ?: "unnamed", r);
while (--i >= 0)
omap_dss_unregister_device(pdata->devices[i]);
goto err_register;
}
if (def_disp_name && strcmp(def_disp_name, dssdev->name) == 0) if (def_disp_name && strcmp(def_disp_name, dssdev->name) == 0)
pdata->default_device = dssdev; pdata->default_device = dssdev;
...@@ -583,8 +590,29 @@ static int omap_dss_probe(struct platform_device *pdev) ...@@ -583,8 +590,29 @@ static int omap_dss_probe(struct platform_device *pdev)
return 0; return 0;
/* XXX fail correctly */ err_register:
fail0: dss_uninitialize_debugfs();
err_debugfs:
if (cpu_is_omap34xx())
dsi_exit();
err_dsi:
if (cpu_is_omap34xx())
sdi_exit();
err_sdi:
venc_exit();
err_venc:
dispc_exit();
err_dispc:
dpi_exit();
err_dpi:
rfbi_exit();
err_rfbi:
dss_exit();
err_dss:
dss_clk_disable_all_no_ctx();
dss_put_clocks();
err_clocks:
return r; return r;
} }
......
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