Linux Tegra architecture development
 help / color / mirror / Atom feed
* [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

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