* [PATCH] spi: tegra: Fix a memory leak in tegra_slink_probe()
@ 2026-02-02 15:15 Felix Gu
2026-02-02 15:38 ` Jon Hunter
2026-02-02 23:33 ` Mark Brown
0 siblings, 2 replies; 3+ messages in thread
From: Felix Gu @ 2026-02-02 15:15 UTC (permalink / raw)
To: Laxman Dewangan, Mark Brown, Thierry Reding, Jonathan Hunter,
Zhang Shurong, Helen Koike
Cc: linux-spi, linux-tegra, linux-kernel, Felix Gu
In tegra_slink_probe(), when platform_get_irq() fails, it directly
returns from the function with an error code, which causes a memory leak.
Replace it with a goto label to ensure proper cleanup.
Fixes: eb9913b511f1 ("spi: tegra: Fix missing IRQ check in tegra_slink_probe()")
Signed-off-by: Felix Gu <ustc.gu@gmail.com>
---
drivers/spi/spi-tegra20-slink.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/spi/spi-tegra20-slink.c b/drivers/spi/spi-tegra20-slink.c
index 7d6f3fe8b7e3..8c608abd6076 100644
--- a/drivers/spi/spi-tegra20-slink.c
+++ b/drivers/spi/spi-tegra20-slink.c
@@ -1086,8 +1086,10 @@ static int tegra_slink_probe(struct platform_device *pdev)
reset_control_deassert(tspi->rst);
spi_irq = platform_get_irq(pdev, 0);
- if (spi_irq < 0)
- return spi_irq;
+ if (spi_irq < 0) {
+ ret = spi_irq;
+ goto exit_pm_put;
+ }
tspi->irq = spi_irq;
ret = request_threaded_irq(tspi->irq, tegra_slink_isr,
tegra_slink_isr_thread, IRQF_ONESHOT,
---
base-commit: 4c87cdd0328495759f6e9f9f4e1e53ef8032a76f
change-id: 20260202-slink-a229f708611d
Best regards,
--
Felix Gu <ustc.gu@gmail.com>
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] spi: tegra: Fix a memory leak in tegra_slink_probe()
2026-02-02 15:15 [PATCH] spi: tegra: Fix a memory leak in tegra_slink_probe() Felix Gu
@ 2026-02-02 15:38 ` Jon Hunter
2026-02-02 23:33 ` Mark Brown
1 sibling, 0 replies; 3+ messages in thread
From: Jon Hunter @ 2026-02-02 15:38 UTC (permalink / raw)
To: Felix Gu, Laxman Dewangan, Mark Brown, Thierry Reding,
Zhang Shurong, Helen Koike
Cc: linux-spi, linux-tegra, linux-kernel
On 02/02/2026 15:15, Felix Gu wrote:
> In tegra_slink_probe(), when platform_get_irq() fails, it directly
> returns from the function with an error code, which causes a memory leak.
>
> Replace it with a goto label to ensure proper cleanup.
>
> Fixes: eb9913b511f1 ("spi: tegra: Fix missing IRQ check in tegra_slink_probe()")
> Signed-off-by: Felix Gu <ustc.gu@gmail.com>
> ---
> drivers/spi/spi-tegra20-slink.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/spi/spi-tegra20-slink.c b/drivers/spi/spi-tegra20-slink.c
> index 7d6f3fe8b7e3..8c608abd6076 100644
> --- a/drivers/spi/spi-tegra20-slink.c
> +++ b/drivers/spi/spi-tegra20-slink.c
> @@ -1086,8 +1086,10 @@ static int tegra_slink_probe(struct platform_device *pdev)
> reset_control_deassert(tspi->rst);
>
> spi_irq = platform_get_irq(pdev, 0);
> - if (spi_irq < 0)
> - return spi_irq;
> + if (spi_irq < 0) {
> + ret = spi_irq;
> + goto exit_pm_put;
> + }
> tspi->irq = spi_irq;
> ret = request_threaded_irq(tspi->irq, tegra_slink_isr,
> tegra_slink_isr_thread, IRQF_ONESHOT,
>
> ---
> base-commit: 4c87cdd0328495759f6e9f9f4e1e53ef8032a76f
> change-id: 20260202-slink-a229f708611d
We could get rid of this 'spi_irq' variable and just use 'ret', but that
is another clean-up. Otherwise ...
Reviewed-by: Jon Hunter <jonathanh@nvidia.com>
Thanks
Jon
--
nvpublic
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] spi: tegra: Fix a memory leak in tegra_slink_probe()
2026-02-02 15:15 [PATCH] spi: tegra: Fix a memory leak in tegra_slink_probe() Felix Gu
2026-02-02 15:38 ` Jon Hunter
@ 2026-02-02 23:33 ` Mark Brown
1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2026-02-02 23:33 UTC (permalink / raw)
To: Laxman Dewangan, Thierry Reding, Jonathan Hunter, Zhang Shurong,
Helen Koike, Felix Gu
Cc: linux-spi, linux-tegra, linux-kernel
On Mon, 02 Feb 2026 23:15:09 +0800, Felix Gu wrote:
> In tegra_slink_probe(), when platform_get_irq() fails, it directly
> returns from the function with an error code, which causes a memory leak.
>
> Replace it with a goto label to ensure proper cleanup.
>
>
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next
Thanks!
[1/1] spi: tegra: Fix a memory leak in tegra_slink_probe()
commit: 41d9a6795b95d6ea28439ac1e9ce8c95bbca20fc
All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying
to this mail.
Thanks,
Mark
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-02-02 23:33 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-02 15:15 [PATCH] spi: tegra: Fix a memory leak in tegra_slink_probe() Felix Gu
2026-02-02 15:38 ` Jon Hunter
2026-02-02 23:33 ` Mark Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox