[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJe_Zhf9E49MkySeqoSFsuy7=j8vmjngda60GEUzTTSNMjj0LA@mail.gmail.com>
Date: Wed, 15 Feb 2023 09:24:19 -0600
From: Jassi Brar <jaswinder.singh@...aro.org>
To: Christophe JAILLET <christophe.jaillet@...adoo.fr>
Cc: Masahisa Kojima <masahisa.kojima@...aro.org>,
Mark Brown <broonie@...nel.org>,
Ard Biesheuvel <ardb@...nel.org>, linux-kernel@...r.kernel.org,
kernel-janitors@...r.kernel.org, linux-spi@...r.kernel.org
Subject: Re: [PATCH] spi: synquacer: Fix timeout handling in synquacer_spi_transfer_one()
On Wed, 15 Feb 2023 at 07:01, Christophe JAILLET
<christophe.jaillet@...adoo.fr> wrote:
>
> wait_for_completion_timeout() never returns a <0 value. It returns either
> on timeout or a positive value (at least 1, or number of jiffies left
> till timeout)
>
> So, fix the error handling path and return -ETIMEDOUT should a timeout
> occur.
>
> Fixes: b0823ee35cf9 ("spi: Add spi driver for Socionext SynQuacer platform")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@...adoo.fr>
> ---
> Compile tested only.
> ---
> drivers/spi/spi-synquacer.c | 7 +++----
> 1 file changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/spi/spi-synquacer.c b/drivers/spi/spi-synquacer.c
> index 47cbe73137c2..dc188f9202c9 100644
> --- a/drivers/spi/spi-synquacer.c
> +++ b/drivers/spi/spi-synquacer.c
> @@ -472,10 +472,9 @@ static int synquacer_spi_transfer_one(struct spi_master *master,
> read_fifo(sspi);
> }
>
> - if (status < 0) {
> - dev_err(sspi->dev, "failed to transfer. status: 0x%x\n",
> - status);
> - return status;
> + if (status == 0) {
> + dev_err(sspi->dev, "failed to transfer. Timeout.\n");
> + return -ETIMEDOUT;
> }
>
> return 0;
>
Acked-by: Jassi Brar <jaswinder.singh@...aro.org>
thanks
Powered by blists - more mailing lists