Skip to content

Commit 66aacfe

Browse files
pinchartltomba
authored andcommitted
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: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
1 parent a25edf0 commit 66aacfe

File tree

6 files changed

+19
-28
lines changed

6 files changed

+19
-28
lines changed

drivers/gpu/drm/omapdrm/dss/dpi.c

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -745,15 +745,14 @@ int dpi_init_port(struct dss_device *dss, struct platform_device *pdev,
745745
return 0;
746746

747747
r = of_property_read_u32(ep, "data-lines", &datalines);
748+
of_node_put(ep);
748749
if (r) {
749750
DSSERR("failed to parse datalines\n");
750-
goto err_datalines;
751+
return r;
751752
}
752753

753754
dpi->data_lines = datalines;
754755

755-
of_node_put(ep);
756-
757756
dpi->pdev = pdev;
758757
dpi->dss_model = dss_model;
759758
dpi->dss = dss;
@@ -764,11 +763,6 @@ int dpi_init_port(struct dss_device *dss, struct platform_device *pdev,
764763
dpi_init_output_port(dpi, port);
765764

766765
return 0;
767-
768-
err_datalines:
769-
of_node_put(ep);
770-
771-
return r;
772766
}
773767

774768
void dpi_uninit_port(struct device_node *port)

drivers/gpu/drm/omapdrm/dss/dsi.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5360,7 +5360,7 @@ static int dsi_bind(struct device *dev, struct device *master, void *data)
53605360

53615361
r = dsi_runtime_get(dsi);
53625362
if (r)
5363-
goto err_runtime_get;
5363+
goto err_pm_disable;
53645364

53655365
rev = dsi_read_reg(dsi, DSI_REVISION);
53665366
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)
53815381
r = dsi_probe_of(dsi);
53825382
if (r) {
53835383
DSSERR("Invalid DSI DT data\n");
5384-
goto err_probe_of;
5384+
goto err_uninit_output;
53855385
}
53865386

53875387
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)
54045404

54055405
return 0;
54065406

5407-
err_probe_of:
5407+
err_uninit_output:
54085408
dsi_uninit_output(dsi);
54095409
dsi_runtime_put(dsi);
5410-
5411-
err_runtime_get:
5410+
err_pm_disable:
54125411
pm_runtime_disable(dev);
54135412
return r;
54145413
}

drivers/gpu/drm/omapdrm/dss/hdmi4.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -780,16 +780,17 @@ static int hdmi4_bind(struct device *dev, struct device *master, void *data)
780780
r = hdmi_audio_register(hdmi);
781781
if (r) {
782782
DSSERR("Registering HDMI audio failed\n");
783-
hdmi_uninit_output(hdmi);
784-
pm_runtime_disable(&pdev->dev);
785-
return r;
783+
goto err_uninit_output;
786784
}
787785

788786
hdmi->debugfs = dss_debugfs_create_file(dss, "hdmi", hdmi_dump_regs,
789787
hdmi);
790788

791789
return 0;
792790

791+
err_uninit_output:
792+
hdmi_uninit_output(hdmi);
793+
pm_runtime_disable(&pdev->dev);
793794
err_pll:
794795
hdmi_pll_uninit(&hdmi->pll);
795796
err_free:

drivers/gpu/drm/omapdrm/dss/hdmi5.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -773,16 +773,17 @@ static int hdmi5_bind(struct device *dev, struct device *master, void *data)
773773
r = hdmi_audio_register(hdmi);
774774
if (r) {
775775
DSSERR("Registering HDMI audio failed %d\n", r);
776-
hdmi_uninit_output(hdmi);
777-
pm_runtime_disable(&pdev->dev);
778-
return r;
776+
goto err_uninit_output;
779777
}
780778

781779
hdmi->debugfs = dss_debugfs_create_file(dss, "hdmi", hdmi_dump_regs,
782780
hdmi);
783781

784782
return 0;
785783

784+
err_uninit_output:
785+
hdmi_uninit_output(hdmi);
786+
pm_runtime_disable(&pdev->dev);
786787
err_pll:
787788
hdmi_pll_uninit(&hdmi->pll);
788789
err_free:

drivers/gpu/drm/omapdrm/dss/sdi.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -358,25 +358,22 @@ int sdi_init_port(struct dss_device *dss, struct platform_device *pdev,
358358
}
359359

360360
r = of_property_read_u32(ep, "datapairs", &datapairs);
361+
of_node_put(ep);
361362
if (r) {
362363
DSSERR("failed to parse datapairs\n");
363-
goto err_datapairs;
364+
goto err_free;
364365
}
365366

366367
sdi->datapairs = datapairs;
367368
sdi->dss = dss;
368369

369-
of_node_put(ep);
370-
371370
sdi->pdev = pdev;
372371
port->data = sdi;
373372

374373
sdi_init_output(sdi);
375374

376375
return 0;
377376

378-
err_datapairs:
379-
of_node_put(ep);
380377
err_free:
381378
kfree(sdi);
382379

drivers/gpu/drm/omapdrm/dss/venc.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -867,7 +867,7 @@ static int venc_bind(struct device *dev, struct device *master, void *data)
867867

868868
r = venc_runtime_get(venc);
869869
if (r)
870-
goto err_runtime_get;
870+
goto err_pm_disable;
871871

872872
rev_id = (u8)(venc_read_reg(venc, VENC_REV_ID) & 0xff);
873873
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)
877877
r = venc_probe_of(venc);
878878
if (r) {
879879
DSSERR("Invalid DT data\n");
880-
goto err_probe_of;
880+
goto err_pm_disable;
881881
}
882882

883883
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)
887887

888888
return 0;
889889

890-
err_probe_of:
891-
err_runtime_get:
890+
err_pm_disable:
892891
pm_runtime_disable(&pdev->dev);
893892
err_free:
894893
kfree(venc);

0 commit comments

Comments
 (0)