Skip to content

Commit

Permalink
drm/mediatek: Add missing put_device() call in mtk_hdmi_dt_parse_pdata()
Browse files Browse the repository at this point in the history
[ 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 <yukuai3@huawei.com>
Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
YuKuai-huawei authored and gregkh committed Sep 23, 2020
1 parent d1025c5 commit e1ddb18
Showing 1 changed file with 18 additions and 8 deletions.
26 changes: 18 additions & 8 deletions drivers/gpu/drm/mediatek/mtk_hdmi.c
Original file line number Diff line number Diff line change
Expand Up @@ -1507,25 +1507,30 @@ static int mtk_hdmi_dt_parse_pdata(struct mtk_hdmi *hdmi,
dev_err(dev,
"Failed to get system configuration registers: %d\n",
ret);
return ret;
goto put_device;
}
hdmi->sys_regmap = regmap;

mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
hdmi->regs = devm_ioremap_resource(dev, mem);
if (IS_ERR(hdmi->regs))
return PTR_ERR(hdmi->regs);
if (IS_ERR(hdmi->regs)) {
ret = PTR_ERR(hdmi->regs);
goto put_device;
}

remote = of_graph_get_remote_node(np, 1, 0);
if (!remote)
return -EINVAL;
if (!remote) {
ret = -EINVAL;
goto put_device;
}

if (!of_device_is_compatible(remote, "hdmi-connector")) {
hdmi->next_bridge = of_drm_find_bridge(remote);
if (!hdmi->next_bridge) {
dev_err(dev, "Waiting for external bridge\n");
of_node_put(remote);
return -EPROBE_DEFER;
ret = -EPROBE_DEFER;
goto put_device;
}
}

Expand All @@ -1534,18 +1539,23 @@ static int mtk_hdmi_dt_parse_pdata(struct mtk_hdmi *hdmi,
dev_err(dev, "Failed to find ddc-i2c-bus node in %pOF\n",
remote);
of_node_put(remote);
return -EINVAL;
ret = -EINVAL;
goto put_device;
}
of_node_put(remote);

hdmi->ddc_adpt = of_find_i2c_adapter_by_node(i2c_np);
of_node_put(i2c_np);
if (!hdmi->ddc_adpt) {
dev_err(dev, "Failed to get ddc i2c adapter by node\n");
return -EINVAL;
ret = -EINVAL;
goto put_device;
}

return 0;
put_device:
put_device(hdmi->cec_dev);
return ret;
}

/*
Expand Down

0 comments on commit e1ddb18

Please sign in to comment.