* Re: [PATCH] spi: atmel: Improve exception handling in atmel_spi_configure_dma()
[not found] ` <82aebf6c-47ac-9d17-2d11-6245f582338e@web.de>
@ 2023-04-07 7:54 ` Nicolas Ferre
0 siblings, 0 replies; only message in thread
From: Nicolas Ferre @ 2023-04-07 7:54 UTC (permalink / raw)
To: Markus Elfring, kernel-janitors, linux-spi, linux-arm-kernel,
Alexandre Belloni, Claudiu Beznea, Mark Brown, Tudor Ambarus,
Yang Yingliang
Cc: cocci, LKML
On 07/04/2023 at 08:22, Markus Elfring wrote:
> Date: Fri, 7 Apr 2023 08:08:59 +0200
>
> The label “error” was used to jump to another pointer check despite of
> the detail in the implementation of the function “atmel_spi_configure_dma”
> that it was determined already that the corresponding variable
> contained an error pointer because of a failed call of
> the function “dma_request_chan”.
>
> * Thus use more appropriate labels instead.
>
> * Delete two redundant checks.
>
>
> This issue was detected by using the Coccinelle software.
>
> Fixes: 398b6b310ec85eef9d98df5963d5ded18aa92ad8 ("spi: atmel: switch to use modern name")
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
It's becoming a pattern, but still:
NACK.
Regards,
Nicolas
> ---
> drivers/spi/spi-atmel.c | 14 +++++++-------
> 1 file changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/spi/spi-atmel.c b/drivers/spi/spi-atmel.c
> index 7f06305e16cb..ed8dc93c73e5 100644
> --- a/drivers/spi/spi-atmel.c
> +++ b/drivers/spi/spi-atmel.c
> @@ -511,12 +511,12 @@ static int atmel_spi_configure_dma(struct spi_controller *host,
> * requested tx channel.
> */
> dev_dbg(dev, "No RX DMA channel, DMA is disabled\n");
> - goto error;
> + goto release_channel_tx;
> }
>
> err = atmel_spi_dma_slave_config(as, 8);
> if (err)
> - goto error;
> + goto release_channel_rx;
>
> dev_info(&as->pdev->dev,
> "Using %s (tx) and %s (rx) for DMA transfers\n",
> @@ -524,11 +524,11 @@ static int atmel_spi_configure_dma(struct spi_controller *host,
> dma_chan_name(host->dma_rx));
>
> return 0;
> -error:
> - if (!IS_ERR(host->dma_rx))
> - dma_release_channel(host->dma_rx);
> - if (!IS_ERR(host->dma_tx))
> - dma_release_channel(host->dma_tx);
> +
> +release_channel_rx:
> + dma_release_channel(host->dma_rx);
> +release_channel_tx:
> + dma_release_channel(host->dma_tx);
> error_clear:
> host->dma_tx = host->dma_rx = NULL;
> return err;
> --
> 2.40.0
>
--
Nicolas Ferre
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-04-07 7:54 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <f9303bdc-b1a7-be5e-56c6-dfa8232b8b55@web.de>
[not found] ` <8f785de5-ebe2-edd9-2155-f440acacc643@web.de>
[not found] ` <82aebf6c-47ac-9d17-2d11-6245f582338e@web.de>
2023-04-07 7:54 ` [PATCH] spi: atmel: Improve exception handling in atmel_spi_configure_dma() Nicolas Ferre
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).