[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAAOTY__jzUgrz9UuRFn104ePfMY5sR4vLuRRFNWVO=1naZUntw@mail.gmail.com>
Date: Tue, 15 Sep 2020 07:44:03 +0800
From: Chun-Kuang Hu <chunkuang.hu@...nel.org>
To: Yu Kuai <yukuai3@...wei.com>
Cc: Chun-Kuang Hu <chunkuang.hu@...nel.org>,
Philipp Zabel <p.zabel@...gutronix.de>,
David Airlie <airlied@...ux.ie>,
Daniel Vetter <daniel@...ll.ch>,
Matthias Brugger <matthias.bgg@...il.com>,
jie.qiu@...iatek.com, junzhi.zhao@...iatek.com,
DRI Development <dri-devel@...ts.freedesktop.org>,
Linux ARM <linux-arm-kernel@...ts.infradead.org>,
"moderated list:ARM/Mediatek SoC support"
<linux-mediatek@...ts.infradead.org>,
linux-kernel <linux-kernel@...r.kernel.org>, yi.zhang@...wei.com
Subject: Re: [PATCH] drm/mediatek: add missing put_device() call in mtk_hdmi_dt_parse_pdata()
Hi, Yu Kuai:
Yu Kuai <yukuai3@...wei.com> 於 2020年9月11日 週五 下午7:22寫道:
>
> 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.
Reviewed-by: Chun-Kuang Hu <chunkuang.hu@...nel.org>
>
> Fixes: 8f83f26891e1 ("drm/mediatek: Add HDMI support")
> Signed-off-by: Yu Kuai <yukuai3@...wei.com>
> ---
> drivers/gpu/drm/mediatek/mtk_hdmi.c | 26 ++++++++++++++++++--------
> 1 file changed, 18 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi.c b/drivers/gpu/drm/mediatek/mtk_hdmi.c
> index f2e9b429960b..a97725680d4e 100644
> --- a/drivers/gpu/drm/mediatek/mtk_hdmi.c
> +++ b/drivers/gpu/drm/mediatek/mtk_hdmi.c
> @@ -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;
> }
> }
>
> @@ -1534,7 +1539,8 @@ 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);
>
> @@ -1542,10 +1548,14 @@ static int mtk_hdmi_dt_parse_pdata(struct mtk_hdmi *hdmi,
> 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;
> }
>
> /*
> --
> 2.25.4
>
Powered by blists - more mailing lists