2020-07-07 08:52:13

by Peng Fan

[permalink] [raw]
Subject: [PATCH] spi: atmel: No need to call spi_master_put() if spi_alloc_master() failed

There is no need to call spi_master_put() if spi_alloc_master()
failed, it should return -ENOMEM directly.

Signed-off-by: Peng Fan <[email protected]>
---
drivers/spi/spi-atmel.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/spi/spi-atmel.c b/drivers/spi/spi-atmel.c
index 57ee8c3..6ed7abd 100644
--- a/drivers/spi/spi-atmel.c
+++ b/drivers/spi/spi-atmel.c
@@ -1546,10 +1546,9 @@ static int atmel_spi_probe(struct platform_device *pdev)
return PTR_ERR(clk);

/* setup spi core then atmel-specific driver state */
- ret = -ENOMEM;
master = spi_alloc_master(&pdev->dev, sizeof(*as));
if (!master)
- goto out_free;
+ return -ENOMEM;

/* the spi->mode bits understood by this driver: */
master->use_gpio_descriptors = true;
--
2.1.0


2020-07-08 17:38:35

by Mark Brown

[permalink] [raw]
Subject: Re: [PATCH] spi: atmel: No need to call spi_master_put() if spi_alloc_master() failed

On Tue, 7 Jul 2020 16:50:42 +0800, Peng Fan wrote:
> There is no need to call spi_master_put() if spi_alloc_master()
> failed, it should return -ENOMEM directly.

Applied to

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

Thanks!

[1/1] spi: atmel: No need to call spi_master_put() if spi_alloc_master() failed
commit: 2d9a744685bc3a4bf1d097782550c450ff0c3b04

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