Commit 2db4578e authored by Christophe JAILLET's avatar Christophe JAILLET Committed by Thierry Reding

drm/tegra: output: Fix missing i2c_put_adapter() in the error handling paths...

drm/tegra: output: Fix missing i2c_put_adapter() in the error handling paths of tegra_output_probe()

If an error occurs after a successful of_get_i2c_adapter_by_node() call, it
should be undone by a corresponding i2c_put_adapter().

Add the missing i2c_put_adapter() call.

Fixes: 9be7d864 ("drm/tegra: Implement panel support")
Signed-off-by: default avatarChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: default avatarThierry Reding <treding@nvidia.com>
Link: https://patchwork.freedesktop.org/patch/msgid/b38604178991e1f08b2cda219103be266be2d680.1693667005.git.christophe.jaillet@wanadoo.fr
parent 45c8034d
......@@ -143,8 +143,10 @@ int tegra_output_probe(struct tegra_output *output)
GPIOD_IN,
"HDMI hotplug detect");
if (IS_ERR(output->hpd_gpio)) {
if (PTR_ERR(output->hpd_gpio) != -ENOENT)
return PTR_ERR(output->hpd_gpio);
if (PTR_ERR(output->hpd_gpio) != -ENOENT) {
err = PTR_ERR(output->hpd_gpio);
goto put_i2c;
}
output->hpd_gpio = NULL;
}
......@@ -153,7 +155,7 @@ int tegra_output_probe(struct tegra_output *output)
err = gpiod_to_irq(output->hpd_gpio);
if (err < 0) {
dev_err(output->dev, "gpiod_to_irq(): %d\n", err);
return err;
goto put_i2c;
}
output->hpd_irq = err;
......@@ -166,7 +168,7 @@ int tegra_output_probe(struct tegra_output *output)
if (err < 0) {
dev_err(output->dev, "failed to request IRQ#%u: %d\n",
output->hpd_irq, err);
return err;
goto put_i2c;
}
output->connector.polled = DRM_CONNECTOR_POLL_HPD;
......@@ -180,6 +182,12 @@ int tegra_output_probe(struct tegra_output *output)
}
return 0;
put_i2c:
if (output->ddc)
i2c_put_adapter(output->ddc);
return err;
}
void tegra_output_remove(struct tegra_output *output)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment