Commit 66aacfe2 authored by Laurent Pinchart's avatar Laurent Pinchart Committed by Tomi Valkeinen

drm/omap: dss: Cleanup error paths in output init functions

Rename the jump labels according to the cleanup they perform, not the
location they're accessed from, and move functions from error checks to
cleanup paths, and move reference handling to simplify cleanup.
Signed-off-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: default avatarSebastian Reichel <sebastian.reichel@collabora.co.uk>
Signed-off-by: default avatarTomi Valkeinen <tomi.valkeinen@ti.com>
parent a25edf0e
...@@ -745,15 +745,14 @@ int dpi_init_port(struct dss_device *dss, struct platform_device *pdev, ...@@ -745,15 +745,14 @@ int dpi_init_port(struct dss_device *dss, struct platform_device *pdev,
return 0; return 0;
r = of_property_read_u32(ep, "data-lines", &datalines); r = of_property_read_u32(ep, "data-lines", &datalines);
of_node_put(ep);
if (r) { if (r) {
DSSERR("failed to parse datalines\n"); DSSERR("failed to parse datalines\n");
goto err_datalines; return r;
} }
dpi->data_lines = datalines; dpi->data_lines = datalines;
of_node_put(ep);
dpi->pdev = pdev; dpi->pdev = pdev;
dpi->dss_model = dss_model; dpi->dss_model = dss_model;
dpi->dss = dss; dpi->dss = dss;
...@@ -764,11 +763,6 @@ int dpi_init_port(struct dss_device *dss, struct platform_device *pdev, ...@@ -764,11 +763,6 @@ int dpi_init_port(struct dss_device *dss, struct platform_device *pdev,
dpi_init_output_port(dpi, port); dpi_init_output_port(dpi, port);
return 0; return 0;
err_datalines:
of_node_put(ep);
return r;
} }
void dpi_uninit_port(struct device_node *port) void dpi_uninit_port(struct device_node *port)
......
...@@ -5360,7 +5360,7 @@ static int dsi_bind(struct device *dev, struct device *master, void *data) ...@@ -5360,7 +5360,7 @@ static int dsi_bind(struct device *dev, struct device *master, void *data)
r = dsi_runtime_get(dsi); r = dsi_runtime_get(dsi);
if (r) if (r)
goto err_runtime_get; goto err_pm_disable;
rev = dsi_read_reg(dsi, DSI_REVISION); rev = dsi_read_reg(dsi, DSI_REVISION);
dev_dbg(dev, "OMAP DSI rev %d.%d\n", dev_dbg(dev, "OMAP DSI rev %d.%d\n",
...@@ -5381,7 +5381,7 @@ static int dsi_bind(struct device *dev, struct device *master, void *data) ...@@ -5381,7 +5381,7 @@ static int dsi_bind(struct device *dev, struct device *master, void *data)
r = dsi_probe_of(dsi); r = dsi_probe_of(dsi);
if (r) { if (r) {
DSSERR("Invalid DSI DT data\n"); DSSERR("Invalid DSI DT data\n");
goto err_probe_of; goto err_uninit_output;
} }
r = of_platform_populate(dev->of_node, NULL, NULL, dev); r = of_platform_populate(dev->of_node, NULL, NULL, dev);
...@@ -5404,11 +5404,10 @@ static int dsi_bind(struct device *dev, struct device *master, void *data) ...@@ -5404,11 +5404,10 @@ static int dsi_bind(struct device *dev, struct device *master, void *data)
return 0; return 0;
err_probe_of: err_uninit_output:
dsi_uninit_output(dsi); dsi_uninit_output(dsi);
dsi_runtime_put(dsi); dsi_runtime_put(dsi);
err_pm_disable:
err_runtime_get:
pm_runtime_disable(dev); pm_runtime_disable(dev);
return r; return r;
} }
......
...@@ -780,9 +780,7 @@ static int hdmi4_bind(struct device *dev, struct device *master, void *data) ...@@ -780,9 +780,7 @@ static int hdmi4_bind(struct device *dev, struct device *master, void *data)
r = hdmi_audio_register(hdmi); r = hdmi_audio_register(hdmi);
if (r) { if (r) {
DSSERR("Registering HDMI audio failed\n"); DSSERR("Registering HDMI audio failed\n");
hdmi_uninit_output(hdmi); goto err_uninit_output;
pm_runtime_disable(&pdev->dev);
return r;
} }
hdmi->debugfs = dss_debugfs_create_file(dss, "hdmi", hdmi_dump_regs, hdmi->debugfs = dss_debugfs_create_file(dss, "hdmi", hdmi_dump_regs,
...@@ -790,6 +788,9 @@ static int hdmi4_bind(struct device *dev, struct device *master, void *data) ...@@ -790,6 +788,9 @@ static int hdmi4_bind(struct device *dev, struct device *master, void *data)
return 0; return 0;
err_uninit_output:
hdmi_uninit_output(hdmi);
pm_runtime_disable(&pdev->dev);
err_pll: err_pll:
hdmi_pll_uninit(&hdmi->pll); hdmi_pll_uninit(&hdmi->pll);
err_free: err_free:
......
...@@ -773,9 +773,7 @@ static int hdmi5_bind(struct device *dev, struct device *master, void *data) ...@@ -773,9 +773,7 @@ static int hdmi5_bind(struct device *dev, struct device *master, void *data)
r = hdmi_audio_register(hdmi); r = hdmi_audio_register(hdmi);
if (r) { if (r) {
DSSERR("Registering HDMI audio failed %d\n", r); DSSERR("Registering HDMI audio failed %d\n", r);
hdmi_uninit_output(hdmi); goto err_uninit_output;
pm_runtime_disable(&pdev->dev);
return r;
} }
hdmi->debugfs = dss_debugfs_create_file(dss, "hdmi", hdmi_dump_regs, hdmi->debugfs = dss_debugfs_create_file(dss, "hdmi", hdmi_dump_regs,
...@@ -783,6 +781,9 @@ static int hdmi5_bind(struct device *dev, struct device *master, void *data) ...@@ -783,6 +781,9 @@ static int hdmi5_bind(struct device *dev, struct device *master, void *data)
return 0; return 0;
err_uninit_output:
hdmi_uninit_output(hdmi);
pm_runtime_disable(&pdev->dev);
err_pll: err_pll:
hdmi_pll_uninit(&hdmi->pll); hdmi_pll_uninit(&hdmi->pll);
err_free: err_free:
......
...@@ -358,16 +358,15 @@ int sdi_init_port(struct dss_device *dss, struct platform_device *pdev, ...@@ -358,16 +358,15 @@ int sdi_init_port(struct dss_device *dss, struct platform_device *pdev,
} }
r = of_property_read_u32(ep, "datapairs", &datapairs); r = of_property_read_u32(ep, "datapairs", &datapairs);
of_node_put(ep);
if (r) { if (r) {
DSSERR("failed to parse datapairs\n"); DSSERR("failed to parse datapairs\n");
goto err_datapairs; goto err_free;
} }
sdi->datapairs = datapairs; sdi->datapairs = datapairs;
sdi->dss = dss; sdi->dss = dss;
of_node_put(ep);
sdi->pdev = pdev; sdi->pdev = pdev;
port->data = sdi; port->data = sdi;
...@@ -375,8 +374,6 @@ int sdi_init_port(struct dss_device *dss, struct platform_device *pdev, ...@@ -375,8 +374,6 @@ int sdi_init_port(struct dss_device *dss, struct platform_device *pdev,
return 0; return 0;
err_datapairs:
of_node_put(ep);
err_free: err_free:
kfree(sdi); kfree(sdi);
......
...@@ -867,7 +867,7 @@ static int venc_bind(struct device *dev, struct device *master, void *data) ...@@ -867,7 +867,7 @@ static int venc_bind(struct device *dev, struct device *master, void *data)
r = venc_runtime_get(venc); r = venc_runtime_get(venc);
if (r) if (r)
goto err_runtime_get; goto err_pm_disable;
rev_id = (u8)(venc_read_reg(venc, VENC_REV_ID) & 0xff); rev_id = (u8)(venc_read_reg(venc, VENC_REV_ID) & 0xff);
dev_dbg(&pdev->dev, "OMAP VENC rev %d\n", rev_id); dev_dbg(&pdev->dev, "OMAP VENC rev %d\n", rev_id);
...@@ -877,7 +877,7 @@ static int venc_bind(struct device *dev, struct device *master, void *data) ...@@ -877,7 +877,7 @@ static int venc_bind(struct device *dev, struct device *master, void *data)
r = venc_probe_of(venc); r = venc_probe_of(venc);
if (r) { if (r) {
DSSERR("Invalid DT data\n"); DSSERR("Invalid DT data\n");
goto err_probe_of; goto err_pm_disable;
} }
venc->debugfs = dss_debugfs_create_file(dss, "venc", venc_dump_regs, venc->debugfs = dss_debugfs_create_file(dss, "venc", venc_dump_regs,
...@@ -887,8 +887,7 @@ static int venc_bind(struct device *dev, struct device *master, void *data) ...@@ -887,8 +887,7 @@ static int venc_bind(struct device *dev, struct device *master, void *data)
return 0; return 0;
err_probe_of: err_pm_disable:
err_runtime_get:
pm_runtime_disable(&pdev->dev); pm_runtime_disable(&pdev->dev);
err_free: err_free:
kfree(venc); kfree(venc);
......
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