drivers/spi/spi-tegra20-slink.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
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>
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
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
© 2016 - 2026 Red Hat, Inc.