Skip to content

Commit

Permalink
drm/tegra: output: Don't leak OF node on error
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
digetx authored and thierryreding committed Sep 17, 2020
1 parent 2340dc1 commit 3d2e7ae
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions drivers/gpu/drm/tegra/output.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,24 +102,24 @@ 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);

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,
Expand Down

0 comments on commit 3d2e7ae

Please sign in to comment.