Skip to content

Commit e8083ac

Browse files
Liu YingpH5
authored andcommitted
drm/imx: dw_hdmi-imx: Fix bailout in error cases of probe
In dw_hdmi_imx_probe(), if error happens after dw_hdmi_probe() returns successfully, dw_hdmi_remove() should be called where necessary as bailout. Fixes: c805ec7 ("drm/imx: dw_hdmi-imx: move initialization into probe") Cc: Philipp Zabel <p.zabel@pengutronix.de> Cc: David Airlie <airlied@linux.ie> Cc: Daniel Vetter <daniel@ffwll.ch> Cc: Shawn Guo <shawnguo@kernel.org> Cc: Sascha Hauer <s.hauer@pengutronix.de> Cc: Pengutronix Kernel Team <kernel@pengutronix.de> Cc: Fabio Estevam <festevam@gmail.com> Cc: NXP Linux Team <linux-imx@nxp.com> Signed-off-by: Liu Ying <victor.liu@nxp.com> Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Link: https://lore.kernel.org/r/20220128091944.3831256-1-victor.liu@nxp.com
1 parent bce81fe commit e8083ac

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

drivers/gpu/drm/imx/dw_hdmi-imx.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,7 @@ static int dw_hdmi_imx_probe(struct platform_device *pdev)
222222
struct device_node *np = pdev->dev.of_node;
223223
const struct of_device_id *match = of_match_node(dw_hdmi_imx_dt_ids, np);
224224
struct imx_hdmi *hdmi;
225+
int ret;
225226

226227
hdmi = devm_kzalloc(&pdev->dev, sizeof(*hdmi), GFP_KERNEL);
227228
if (!hdmi)
@@ -243,10 +244,15 @@ static int dw_hdmi_imx_probe(struct platform_device *pdev)
243244
hdmi->bridge = of_drm_find_bridge(np);
244245
if (!hdmi->bridge) {
245246
dev_err(hdmi->dev, "Unable to find bridge\n");
247+
dw_hdmi_remove(hdmi->hdmi);
246248
return -ENODEV;
247249
}
248250

249-
return component_add(&pdev->dev, &dw_hdmi_imx_ops);
251+
ret = component_add(&pdev->dev, &dw_hdmi_imx_ops);
252+
if (ret)
253+
dw_hdmi_remove(hdmi->hdmi);
254+
255+
return ret;
250256
}
251257

252258
static int dw_hdmi_imx_remove(struct platform_device *pdev)

0 commit comments

Comments
 (0)