summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/tegra/output.c
diff options
context:
space:
mode:
authorDmitry Osipenko <digetx@gmail.com>2020-08-14 01:06:53 +0300
committerThierry Reding <treding@nvidia.com>2020-09-17 12:29:39 +0200
commit3d2e7aec70130af53289eccd41696c15ce2c3e89 (patch)
treef0dfe4e99123b4a18e68a6de8719ce575884485a /drivers/gpu/drm/tegra/output.c
parent2340dc15f05f595688ae10f6512cef5ad51476d3 (diff)
downloadlinux-3d2e7aec70130af53289eccd41696c15ce2c3e89.tar.bz2
drm/tegra: output: Don't leak OF node on error
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@ideasonboard.com> Reviewed-by: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: Dmitry Osipenko <digetx@gmail.com> Signed-off-by: Thierry Reding <treding@nvidia.com>
Diffstat (limited to 'drivers/gpu/drm/tegra/output.c')
-rw-r--r--drivers/gpu/drm/tegra/output.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/gpu/drm/tegra/output.c b/drivers/gpu/drm/tegra/output.c
index 03382550f7d9..f050c8bac398 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,13 @@ 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_get_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,