2021-05-09 19:15:43

by Christophe JAILLET

[permalink] [raw]
Subject: [PATCH] spi: spi-fsl-dspi: Fix a resource leak in an error handling path

'dspi_request_dma()' should be undone by a 'dspi_release_dma()' call in the
error handling path of the probe function, as already done in the remove
function

Fixes: 90ba37033cb9 ("spi: spi-fsl-dspi: Add DMA support for Vybrid")
Signed-off-by: Christophe JAILLET <[email protected]>
---
drivers/spi/spi-fsl-dspi.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/spi/spi-fsl-dspi.c b/drivers/spi/spi-fsl-dspi.c
index 028736687488..fb45e6af6638 100644
--- a/drivers/spi/spi-fsl-dspi.c
+++ b/drivers/spi/spi-fsl-dspi.c
@@ -1375,11 +1375,13 @@ static int dspi_probe(struct platform_device *pdev)
ret = spi_register_controller(ctlr);
if (ret != 0) {
dev_err(&pdev->dev, "Problem registering DSPI ctlr\n");
- goto out_free_irq;
+ goto out_release_dma;
}

return ret;

+out_release_dma:
+ dspi_release_dma(dspi);
out_free_irq:
if (dspi->irq)
free_irq(dspi->irq, dspi);
--
2.30.2


2021-05-09 19:27:54

by Vladimir Oltean

[permalink] [raw]
Subject: Re: [PATCH] spi: spi-fsl-dspi: Fix a resource leak in an error handling path

On Sun, May 09, 2021 at 09:12:27PM +0200, Christophe JAILLET wrote:
> 'dspi_request_dma()' should be undone by a 'dspi_release_dma()' call in the
> error handling path of the probe function, as already done in the remove
> function
>
> Fixes: 90ba37033cb9 ("spi: spi-fsl-dspi: Add DMA support for Vybrid")
> Signed-off-by: Christophe JAILLET <[email protected]>
> ---

Reviewed-by: Vladimir Oltean <[email protected]>

Thanks!

2021-05-11 08:28:25

by Mark Brown

[permalink] [raw]
Subject: Re: [PATCH] spi: spi-fsl-dspi: Fix a resource leak in an error handling path

On Sun, 9 May 2021 21:12:27 +0200, Christophe JAILLET wrote:
> 'dspi_request_dma()' should be undone by a 'dspi_release_dma()' call in the
> error handling path of the probe function, as already done in the remove
> function

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next

Thanks!

[1/1] spi: spi-fsl-dspi: Fix a resource leak in an error handling path
commit: 680ec0549a055eb464dce6ffb4bfb736ef87236e

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