[PATCH v2 06/10] spi: atmel-quadspi: return appropriate error code

From: Tudor.Ambarus
Date: Thu Jan 31 2019 - 11:15:52 EST


From: Tudor Ambarus <tudor.ambarus@xxxxxxxxxxxxx>

Return -ENOTSUPP when atmel_qspi_find_mode() fails. Propagate
the error in atmel_qspi_exec_op().

Signed-off-by: Tudor Ambarus <tudor.ambarus@xxxxxxxxxxxxx>
Reviewed-by: Boris Brezillon <bbrezillon@xxxxxxxxxx>
---
v2: collect R-b

drivers/spi/atmel-quadspi.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/spi/atmel-quadspi.c b/drivers/spi/atmel-quadspi.c
index 2db935488270..1f7cf5d2953a 100644
--- a/drivers/spi/atmel-quadspi.c
+++ b/drivers/spi/atmel-quadspi.c
@@ -198,7 +198,7 @@ static int atmel_qspi_find_mode(const struct spi_mem_op *op)
if (atmel_qspi_is_compatible(op, &sama5d2_qspi_modes[i]))
return i;

- return -1;
+ return -ENOTSUPP;
}

static bool atmel_qspi_supports_op(struct spi_mem *mem,
@@ -234,7 +234,7 @@ static int atmel_qspi_exec_op(struct spi_mem *mem, const struct spi_mem_op *op)

mode = atmel_qspi_find_mode(op);
if (mode < 0)
- return -ENOTSUPP;
+ return mode;

ifr |= sama5d2_qspi_modes[mode].config;

--
2.9.5