[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <65351f67-4d35-b175-83a7-bb1dbe1b6f86@microchip.com>
Date: Wed, 9 Jun 2021 10:00:33 +0200
From: Nicolas Ferre <nicolas.ferre@...rochip.com>
To: zpershuai <zpershuai@...il.com>,
Radu Pirea <radu_nicolae.pirea@....ro>,
Mark Brown <broonie@...nel.org>,
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>
Subject: Re: [PATCH v2] spi: spi-at91-usart: Fix wrong goto jump label when spi_alloc_master() returns error.
On 09/06/2021 at 04:48, zpershuai wrote:
> 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.
So, I don't see the benefit in changing then.
at91_usart_spi_probe_fail label is nicely unified across the probe
function and having it called once more or once less is no interest to me.
Sorry but NACK until someone persuades me it's needed or common pattern
among spi drivers.
Regards,
Nicolas
> Signed-off-by: zpershuai <zpershuai@...il.com>
> ---
> drivers/spi/spi-at91-usart.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/spi/spi-at91-usart.c b/drivers/spi/spi-at91-usart.c
> index 8c83526..e5c2d2c 100644
> --- a/drivers/spi/spi-at91-usart.c
> +++ b/drivers/spi/spi-at91-usart.c
> @@ -531,10 +531,9 @@ static int at91_usart_spi_probe(struct platform_device *pdev)
> if (IS_ERR(clk))
> return PTR_ERR(clk);
>
> - ret = -ENOMEM;
> controller = spi_alloc_master(&pdev->dev, sizeof(*aus));
> if (!controller)
> - goto at91_usart_spi_probe_fail;
> + return -ENOMEM;
>
> ret = at91_usart_gpio_setup(pdev);
> if (ret)
> --
> 2.7.4
>
--
Nicolas Ferre
Powered by blists - more mailing lists