From: Laurent Pinchart Subject: Re: [PATCH v3 1/2] drm/tegra: output: Don't leak OF node on error Date: Thu, 16 Apr 2020 20:27:27 +0300 Message-ID: <20200416172727.GN4796@pendragon.ideasonboard.com> References: <20200416172405.5051-1-digetx@gmail.com> <20200416172405.5051-2-digetx@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Return-path: Content-Disposition: inline In-Reply-To: <20200416172405.5051-2-digetx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> Sender: linux-tegra-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Dmitry Osipenko Cc: Thierry Reding , Sam Ravnborg , dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org, linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org List-Id: linux-tegra@vger.kernel.org Hi Dmitry, Thank you for the patch. On Thu, Apr 16, 2020 at 08:24:04PM +0300, Dmitry Osipenko wrote: > The OF node should be put before returning error in tegra_output_probe(), > otherwise node's refcount will be leaked. > > Signed-off-by: Dmitry Osipenko Reviewed-by: Laurent Pinchart > --- > 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, -- Regards, Laurent Pinchart