[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200506164215.GC19296@ravnborg.org>
Date: Wed, 6 May 2020 18:42:15 +0200
From: Sam Ravnborg <sam@...nborg.org>
To: Dmitry Osipenko <digetx@...il.com>
Cc: Thierry Reding <thierry.reding@...il.com>,
Laurent Pinchart <laurent.pinchart@...asonboard.com>,
Rob Herring <robh+dt@...nel.org>,
Frank Rowand <frowand.list@...il.com>,
linux-tegra@...r.kernel.org, devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org, dri-devel@...ts.freedesktop.org
Subject: Re: [PATCH v5 3/6] drm/tegra: output: Don't leak OF node on error
On Sat, Apr 18, 2020 at 08:07:00PM +0300, Dmitry Osipenko wrote:
> The OF node should be put before returning error in tegra_output_probe(),
> otherwise node's refcount will be leaked.
>
> Reviewed-by: Laurent Pinchart <laurent.pinchart@...asonboard.com>
> Signed-off-by: Dmitry Osipenko <digetx@...il.com>
Reviewed-by: Sam Ravnborg <sam@...nborg.org>
> ---
> drivers/gpu/drm/tegra/output.c | 9 ++++-----
> 1 file changed, 4 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/tegra/output.c b/drivers/gpu/drm/tegra/output.c
> index e36e5e7c2f69..a6a711d54e88 100644
> --- a/drivers/gpu/drm/tegra/output.c
> +++ b/drivers/gpu/drm/tegra/output.c
> @@ -102,10 +102,10 @@ int tegra_output_probe(struct tegra_output *output)
> panel = of_parse_phandle(output->of_node, "nvidia,panel", 0);
> if (panel) {
> output->panel = of_drm_find_panel(panel);
> + of_node_put(panel);
> +
> if (IS_ERR(output->panel))
> return PTR_ERR(output->panel);
> -
> - of_node_put(panel);
> }
>
> output->edid = of_get_property(output->of_node, "nvidia,edid", &size);
> @@ -113,13 +113,12 @@ int tegra_output_probe(struct tegra_output *output)
> ddc = of_parse_phandle(output->of_node, "nvidia,ddc-i2c-bus", 0);
> if (ddc) {
> output->ddc = of_find_i2c_adapter_by_node(ddc);
> + of_node_put(ddc);
> +
> if (!output->ddc) {
> err = -EPROBE_DEFER;
> - of_node_put(ddc);
> return err;
> }
> -
> - of_node_put(ddc);
> }
>
> output->hpd_gpio = devm_gpiod_get_from_of_node(output->dev,
> --
> 2.26.0
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@...ts.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
Powered by blists - more mailing lists