Re: [PATCH] drm/tegra: Fix a strange error handling path

Thierry Reding <[email protected]> Mon, 22 Jun 2026 08:49:19 +0200
Newsgroups org.kernel.vger.kernel-janitors,org.freedesktop.lists.dri-devel,org.kernel.vger.linux-kernel,org.kernel.vger.linux-tegra
Message-ID <ajjaW_fGdHWPZr9K@orome>
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 <[email protected]>
> ---
> 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
signature.asc (application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE-----

iQIzBAABCgAdFiEEiOrDCAFJzPfAjcif3SOs138+s6EFAmo42usACgkQ3SOs138+
s6GSbA//VUr9ah6aJm5qD5DKf1B6cLsg2AIC61cAOTFggrPwRm11eLgTNgtdv0rd
UZz2PFAt1YzKNlA/vIM1W1Z1Zjf3r2uXnBMgFmS1CbIVf6zPt0webV1kIUhtrPNf
Ln/WoJGJocjvAujFvOXKzFL7OE8R8TBKuGCUAHr96+XIfAABlBuuk4X8sxoiO0WD
DW8RNYP+e2UaxOZhJcJt4jVaalfLMS2o6KdOP37cSECDIVoCMUXQNqM7Hx7kcN7+
RQq9mvRe4E5zJiP7cOkCwQgjRocFbBbuqkFYcTKhKmvYshZb4hKwjtIyQ2SrVbc5
H0TWlYGEX9jQAApPn96Xm90nieYPXSaz3+vYwN+PjTACQMLPoJvd54K9JpshtyAs
wX4zIRkheTc5eFjv4lNUDsJYw47ivzEnIj3+DTRsmK8JDwY8XZw3Wdrow5c7HLNT
JvH6HSfUG+mf6AMeb5fp53ztJyRKHwd4g+iDzAR6kxRf+NDL5ZhX6tAhRCN2Vv7w
sVMKvoC67uReGFQXvLiONTYtl1IyDSaXyDn+xwEl4XR3juudFwW7LOiwEvySHeye
BVvFPauNP8QAYKwp6CsCituDXHHsscG1U9SRTh/rEJcxyiagTDJ+DTf4Pr95UxrZ
AbDVQDrueHk3MZntlVFRagAu1XEeLUb8AeB5GCfLKB7z0xbUlrc=
=kXhu
-----END PGP SIGNATURE-----