Skip to content

Commit b8eec12

Browse files
outman119gregkh
authored andcommitted
spi: tegra: Fix a memory leak in tegra_slink_probe()
[ Upstream commit 41d9a67 ] 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: eb9913b ("spi: tegra: Fix missing IRQ check in tegra_slink_probe()") Signed-off-by: Felix Gu <[email protected]> Reviewed-by: Jon Hunter <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Mark Brown <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent 2ac3a10 commit b8eec12

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

drivers/spi/spi-tegra20-slink.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1086,8 +1086,10 @@ static int tegra_slink_probe(struct platform_device *pdev)
10861086
reset_control_deassert(tspi->rst);
10871087

10881088
spi_irq = platform_get_irq(pdev, 0);
1089-
if (spi_irq < 0)
1090-
return spi_irq;
1089+
if (spi_irq < 0) {
1090+
ret = spi_irq;
1091+
goto exit_pm_put;
1092+
}
10911093
tspi->irq = spi_irq;
10921094
ret = request_threaded_irq(tspi->irq, tegra_slink_isr,
10931095
tegra_slink_isr_thread, IRQF_ONESHOT,

0 commit comments

Comments
 (0)