* [PATCH] drm/tegra: Fix a strange error handling path
@ 2026-06-20 19:23 Christophe JAILLET
2026-06-22 6:49 ` Thierry Reding
2026-06-22 6:50 ` Thierry Reding
0 siblings, 2 replies; 3+ messages in thread
From: Christophe JAILLET @ 2026-06-20 19:23 UTC (permalink / raw)
To: Thierry Reding, Mikko Perttunen, David Airlie, Simona Vetter,
Jonathan Hunter
Cc: linux-kernel, kernel-janitors, Christophe JAILLET, dri-devel,
linux-tegra
The resource freed at the 'put_aux' label is "sor->aux->dev".
However, this resource is taken after devm_tegra_pmc_get(), so there is no
point to release it in this error handling path.
This is harmless because put_device() will be called with a NULL pointer,
but this is confusing.
So, fix the logic and return directly.
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
Compile tested only.
This is not a bug, so no need for a Fixes tag.
If needed anyway, it was introduced by commit e68c4244136b ("drm/tegra:
Explicitly specify PMC instance to use")
---
drivers/gpu/drm/tegra/sor.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/tegra/sor.c b/drivers/gpu/drm/tegra/sor.c
index 4032c6ad45bc..e384cbd0cbf7 100644
--- a/drivers/gpu/drm/tegra/sor.c
+++ b/drivers/gpu/drm/tegra/sor.c
@@ -3764,10 +3764,8 @@ static int tegra_sor_probe(struct platform_device *pdev)
sor->num_settings = sor->soc->num_settings;
sor->pmc = devm_tegra_pmc_get(&pdev->dev);
- if (IS_ERR(sor->pmc)) {
- err = PTR_ERR(sor->pmc);
- goto put_aux;
- }
+ if (IS_ERR(sor->pmc))
+ return PTR_ERR(sor->pmc);
np = of_parse_phandle(pdev->dev.of_node, "nvidia,dpaux", 0);
if (np) {
--
2.54.0
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] drm/tegra: Fix a strange error handling path
2026-06-20 19:23 [PATCH] drm/tegra: Fix a strange error handling path Christophe JAILLET
@ 2026-06-22 6:49 ` Thierry Reding
2026-06-22 6:50 ` Thierry Reding
1 sibling, 0 replies; 3+ messages in thread
From: Thierry Reding @ 2026-06-22 6:49 UTC (permalink / raw)
To: Christophe JAILLET
Cc: Mikko Perttunen, David Airlie, Simona Vetter, Jonathan Hunter,
linux-kernel, kernel-janitors, dri-devel, linux-tegra
[-- Attachment #1: Type: text/plain, Size: 960 bytes --]
On Sat, Jun 20, 2026 at 09:23:14PM +0200, Christophe JAILLET wrote:
> The resource freed at the 'put_aux' label is "sor->aux->dev".
> However, this resource is taken after devm_tegra_pmc_get(), so there is no
> point to release it in this error handling path.
>
> This is harmless because put_device() will be called with a NULL pointer,
> but this is confusing.
>
> So, fix the logic and return directly.
>
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> Compile tested only.
>
> This is not a bug, so no need for a Fixes tag.
> If needed anyway, it was introduced by commit e68c4244136b ("drm/tegra:
> Explicitly specify PMC instance to use")
> ---
> drivers/gpu/drm/tegra/sor.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
Good catch! Looks like I used the put_aux label without realizing that
sor->aux isn't acquired until *after* sor->pmc here.
Thanks for fixing this,
Thierry
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] drm/tegra: Fix a strange error handling path
2026-06-20 19:23 [PATCH] drm/tegra: Fix a strange error handling path Christophe JAILLET
2026-06-22 6:49 ` Thierry Reding
@ 2026-06-22 6:50 ` Thierry Reding
1 sibling, 0 replies; 3+ messages in thread
From: Thierry Reding @ 2026-06-22 6:50 UTC (permalink / raw)
To: Thierry Reding, Mikko Perttunen, David Airlie, Simona Vetter,
Jonathan Hunter, Christophe JAILLET
Cc: linux-kernel, kernel-janitors, dri-devel, linux-tegra
From: Thierry Reding <treding@nvidia.com>
On Sat, 20 Jun 2026 21:23:14 +0200, Christophe JAILLET wrote:
> The resource freed at the 'put_aux' label is "sor->aux->dev".
> However, this resource is taken after devm_tegra_pmc_get(), so there is no
> point to release it in this error handling path.
>
> This is harmless because put_device() will be called with a NULL pointer,
> but this is confusing.
>
> [...]
Applied, thanks!
[1/1] drm/tegra: Fix a strange error handling path
commit: e60d3f9b4c89ffff5472ddc2829d5e29bcb153fe
Best regards,
--
Thierry Reding <treding@nvidia.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-06-22 6:50 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-20 19:23 [PATCH] drm/tegra: Fix a strange error handling path Christophe JAILLET
2026-06-22 6:49 ` Thierry Reding
2026-06-22 6:50 ` Thierry Reding
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox