[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAG3jFyt5EG=OBk+pVwwHeeh_XgsCV82p-KiLcnL_yv8L1wUZ8Q@mail.gmail.com>
Date: Thu, 21 Apr 2022 14:24:59 +0200
From: Robert Foss <robert.foss@...aro.org>
To: Miaoqian Lin <linmq006@...il.com>
Cc: Andrzej Hajda <andrzej.hajda@...el.com>,
Neil Armstrong <narmstrong@...libre.com>,
Laurent Pinchart <Laurent.pinchart@...asonboard.com>,
Jonas Karlman <jonas@...boo.se>,
Jernej Skrabec <jernej.skrabec@...il.com>,
David Airlie <airlied@...ux.ie>,
Daniel Vetter <daniel@...ll.ch>,
Dave Airlie <airlied@...hat.com>,
Tomi Valkeinen <tomi.valkeinen@...asonboard.com>,
Jyri Sarha <jyri.sarha@....fi>, Lyude Paul <lyude@...hat.com>,
Maxime Ripard <maxime@...no.tech>,
Yakir Yang <kuankuan.y@...il.com>,
Inki Dae <inki.dae@...sung.com>,
Heiko Stuebner <heiko@...ech.de>,
dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] drm/bridge: Fix error handling in analogix_dp_probe
On Wed, 20 Apr 2022 at 03:16, Miaoqian Lin <linmq006@...il.com> wrote:
>
> In the error handling path, the clk_prepare_enable() function
> call should be balanced by a corresponding 'clk_disable_unprepare()'
> call , as already done in the remove function.
>
> Fixes: 3424e3a4f844 ("drm: bridge: analogix/dp: split exynos dp driver to bridge directory")
> Signed-off-by: Miaoqian Lin <linmq006@...il.com>
> ---
> changes in v2:
> - remove the wrong return statement.
> ---
> .../gpu/drm/bridge/analogix/analogix_dp_core.c | 18 +++++++++++++-----
> 1 file changed, 13 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
> index eb590fb8e8d0..474ef88015ae 100644
> --- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
> +++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
> @@ -1698,8 +1698,10 @@ analogix_dp_probe(struct device *dev, struct analogix_dp_plat_data *plat_data)
> res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>
> dp->reg_base = devm_ioremap_resource(&pdev->dev, res);
> - if (IS_ERR(dp->reg_base))
> - return ERR_CAST(dp->reg_base);
> + if (IS_ERR(dp->reg_base)) {
> + ret = PTR_ERR(dp->reg_base);
> + goto err_disable_clk;
> + }
>
> dp->force_hpd = of_property_read_bool(dev->of_node, "force-hpd");
>
> @@ -1711,7 +1713,8 @@ analogix_dp_probe(struct device *dev, struct analogix_dp_plat_data *plat_data)
> if (IS_ERR(dp->hpd_gpiod)) {
> dev_err(dev, "error getting HDP GPIO: %ld\n",
> PTR_ERR(dp->hpd_gpiod));
> - return ERR_CAST(dp->hpd_gpiod);
> + ret = PTR_ERR(dp->hpd_gpiod);
> + goto err_disable_clk;
> }
>
> if (dp->hpd_gpiod) {
> @@ -1731,7 +1734,8 @@ analogix_dp_probe(struct device *dev, struct analogix_dp_plat_data *plat_data)
>
> if (dp->irq == -ENXIO) {
> dev_err(&pdev->dev, "failed to get irq\n");
> - return ERR_PTR(-ENODEV);
> + ret = -ENODEV;
> + goto err_disable_clk;
> }
>
> ret = devm_request_threaded_irq(&pdev->dev, dp->irq,
> @@ -1740,11 +1744,15 @@ analogix_dp_probe(struct device *dev, struct analogix_dp_plat_data *plat_data)
> irq_flags, "analogix-dp", dp);
> if (ret) {
> dev_err(&pdev->dev, "failed to request irq\n");
> - return ERR_PTR(ret);
> + goto err_disable_clk;
> }
> disable_irq(dp->irq);
>
> return dp;
> +
> +err_disable_clk:
> + clk_disable_unprepare(dp->clock);
> + return ERR_PTR(ret);
> }
> EXPORT_SYMBOL_GPL(analogix_dp_probe);
>
Reviewed-by: Robert Foss <robert.foss@...aro.org>
Applied to drm-misc-next.
Powered by blists - more mailing lists