]>
Commit | Line | Data |
---|---|---|
8125e326 SL |
1 | From eb7f2c5ad2fc9f240063d838a04fbb84d7f4e1a6 Mon Sep 17 00:00:00 2001 |
2 | From: Sasha Levin <sashal@kernel.org> | |
3 | Date: Sat, 2 Sep 2023 17:22:13 +0200 | |
4 | Subject: drm/tegra: output: Fix missing i2c_put_adapter() in the error | |
5 | handling paths of tegra_output_probe() | |
6 | ||
7 | From: Christophe JAILLET <christophe.jaillet@wanadoo.fr> | |
8 | ||
9 | [ Upstream commit 2db4578ef6ffb2b52115ca0ebf897b60ec559556 ] | |
10 | ||
11 | If an error occurs after a successful of_get_i2c_adapter_by_node() call, it | |
12 | should be undone by a corresponding i2c_put_adapter(). | |
13 | ||
14 | Add the missing i2c_put_adapter() call. | |
15 | ||
16 | Fixes: 9be7d864cf07 ("drm/tegra: Implement panel support") | |
17 | Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> | |
18 | Signed-off-by: Thierry Reding <treding@nvidia.com> | |
19 | Link: https://patchwork.freedesktop.org/patch/msgid/b38604178991e1f08b2cda219103be266be2d680.1693667005.git.christophe.jaillet@wanadoo.fr | |
20 | Signed-off-by: Sasha Levin <sashal@kernel.org> | |
21 | --- | |
22 | drivers/gpu/drm/tegra/output.c | 16 ++++++++++++---- | |
23 | 1 file changed, 12 insertions(+), 4 deletions(-) | |
24 | ||
25 | diff --git a/drivers/gpu/drm/tegra/output.c b/drivers/gpu/drm/tegra/output.c | |
26 | index 47d26b5d99456..7ccd010a821b7 100644 | |
27 | --- a/drivers/gpu/drm/tegra/output.c | |
28 | +++ b/drivers/gpu/drm/tegra/output.c | |
29 | @@ -139,8 +139,10 @@ int tegra_output_probe(struct tegra_output *output) | |
30 | GPIOD_IN, | |
31 | "HDMI hotplug detect"); | |
32 | if (IS_ERR(output->hpd_gpio)) { | |
33 | - if (PTR_ERR(output->hpd_gpio) != -ENOENT) | |
34 | - return PTR_ERR(output->hpd_gpio); | |
35 | + if (PTR_ERR(output->hpd_gpio) != -ENOENT) { | |
36 | + err = PTR_ERR(output->hpd_gpio); | |
37 | + goto put_i2c; | |
38 | + } | |
39 | ||
40 | output->hpd_gpio = NULL; | |
41 | } | |
42 | @@ -149,7 +151,7 @@ int tegra_output_probe(struct tegra_output *output) | |
43 | err = gpiod_to_irq(output->hpd_gpio); | |
44 | if (err < 0) { | |
45 | dev_err(output->dev, "gpiod_to_irq(): %d\n", err); | |
46 | - return err; | |
47 | + goto put_i2c; | |
48 | } | |
49 | ||
50 | output->hpd_irq = err; | |
51 | @@ -162,7 +164,7 @@ int tegra_output_probe(struct tegra_output *output) | |
52 | if (err < 0) { | |
53 | dev_err(output->dev, "failed to request IRQ#%u: %d\n", | |
54 | output->hpd_irq, err); | |
55 | - return err; | |
56 | + goto put_i2c; | |
57 | } | |
58 | ||
59 | output->connector.polled = DRM_CONNECTOR_POLL_HPD; | |
60 | @@ -176,6 +178,12 @@ int tegra_output_probe(struct tegra_output *output) | |
61 | } | |
62 | ||
63 | return 0; | |
64 | + | |
65 | +put_i2c: | |
66 | + if (output->ddc) | |
67 | + i2c_put_adapter(output->ddc); | |
68 | + | |
69 | + return err; | |
70 | } | |
71 | ||
72 | void tegra_output_remove(struct tegra_output *output) | |
73 | -- | |
74 | 2.43.0 | |
75 |