[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1623165248-24038-1-git-send-email-zpershuai@gmail.com>
Date: Tue, 8 Jun 2021 23:14:07 +0800
From: zpershuai <zpershuai@...il.com>
To: Radu Pirea <radu_nicolae.pirea@....ro>,
Mark Brown <broonie@...nel.org>,
Nicolas Ferre <nicolas.ferre@...rochip.com>,
Alexandre Belloni <alexandre.belloni@...tlin.com>,
Ludovic Desroches <ludovic.desroches@...rochip.com>,
linux-spi@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
linux-kernel@...r.kernel.org
Cc: zpershuai <zpershuai@...il.com>
Subject: [PATCH] spi: spi-at91-usart: Fix wrong goto jump label when spi_alloc_master() returns error.
When spi_alloc_master() returns null pointer, it’s no need to use
spi_master_put() to release the memory, although spi_master_put()
function has null pointer checks.
Signed-off-by: zpershuai <zpershuai@...il.com>
---
drivers/spi/spi-at91-usart.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/spi/spi-at91-usart.c b/drivers/spi/spi-at91-usart.c
index 8c83526..c8136dc 100644
--- a/drivers/spi/spi-at91-usart.c
+++ b/drivers/spi/spi-at91-usart.c
@@ -533,8 +533,10 @@ static int at91_usart_spi_probe(struct platform_device *pdev)
ret = -ENOMEM;
controller = spi_alloc_master(&pdev->dev, sizeof(*aus));
- if (!controller)
- goto at91_usart_spi_probe_fail;
+ if (!controller) {
+ dev_err(&pdev->dev, "Error allocating SPI controller\n");
+ return -ENOMEM;
+ }
ret = at91_usart_gpio_setup(pdev);
if (ret)
--
2.7.4
Powered by blists - more mailing lists