Skip to content

Commit e1ddb18

Browse files
YuKuai-huaweigregkh
authored andcommitted
drm/mediatek: Add missing put_device() call in mtk_hdmi_dt_parse_pdata()
[ Upstream commit 0680a62 ] if of_find_device_by_node() succeed, mtk_drm_kms_init() doesn't have a corresponding put_device(). Thus add jump target to fix the exception handling for this function implementation. Fixes: 8f83f26 ("drm/mediatek: Add HDMI support") Signed-off-by: Yu Kuai <[email protected]> Signed-off-by: Chun-Kuang Hu <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent d1025c5 commit e1ddb18

File tree

1 file changed

+18
-8
lines changed

1 file changed

+18
-8
lines changed

drivers/gpu/drm/mediatek/mtk_hdmi.c

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1507,25 +1507,30 @@ static int mtk_hdmi_dt_parse_pdata(struct mtk_hdmi *hdmi,
15071507
dev_err(dev,
15081508
"Failed to get system configuration registers: %d\n",
15091509
ret);
1510-
return ret;
1510+
goto put_device;
15111511
}
15121512
hdmi->sys_regmap = regmap;
15131513

15141514
mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
15151515
hdmi->regs = devm_ioremap_resource(dev, mem);
1516-
if (IS_ERR(hdmi->regs))
1517-
return PTR_ERR(hdmi->regs);
1516+
if (IS_ERR(hdmi->regs)) {
1517+
ret = PTR_ERR(hdmi->regs);
1518+
goto put_device;
1519+
}
15181520

15191521
remote = of_graph_get_remote_node(np, 1, 0);
1520-
if (!remote)
1521-
return -EINVAL;
1522+
if (!remote) {
1523+
ret = -EINVAL;
1524+
goto put_device;
1525+
}
15221526

15231527
if (!of_device_is_compatible(remote, "hdmi-connector")) {
15241528
hdmi->next_bridge = of_drm_find_bridge(remote);
15251529
if (!hdmi->next_bridge) {
15261530
dev_err(dev, "Waiting for external bridge\n");
15271531
of_node_put(remote);
1528-
return -EPROBE_DEFER;
1532+
ret = -EPROBE_DEFER;
1533+
goto put_device;
15291534
}
15301535
}
15311536

@@ -1534,18 +1539,23 @@ static int mtk_hdmi_dt_parse_pdata(struct mtk_hdmi *hdmi,
15341539
dev_err(dev, "Failed to find ddc-i2c-bus node in %pOF\n",
15351540
remote);
15361541
of_node_put(remote);
1537-
return -EINVAL;
1542+
ret = -EINVAL;
1543+
goto put_device;
15381544
}
15391545
of_node_put(remote);
15401546

15411547
hdmi->ddc_adpt = of_find_i2c_adapter_by_node(i2c_np);
15421548
of_node_put(i2c_np);
15431549
if (!hdmi->ddc_adpt) {
15441550
dev_err(dev, "Failed to get ddc i2c adapter by node\n");
1545-
return -EINVAL;
1551+
ret = -EINVAL;
1552+
goto put_device;
15461553
}
15471554

15481555
return 0;
1556+
put_device:
1557+
put_device(hdmi->cec_dev);
1558+
return ret;
15491559
}
15501560

15511561
/*

0 commit comments

Comments
 (0)