linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] spi: Fix error code checking in spi_mem_exec_op()
@ 2024-03-13 17:10 Florian Fainelli
  2024-03-13 17:33 ` Michael Walle
  2024-03-15 17:13 ` Mark Brown
  0 siblings, 2 replies; 13+ messages in thread
From: Florian Fainelli @ 2024-03-13 17:10 UTC (permalink / raw)
  To: linux-spi
  Cc: Florian Fainelli, Mark Brown, Miquel Raynal, Mika Westerberg,
	Michael Walle, Chia-Lin Kao (AceLan), open list

After commit cff49d58f57e ("spi: Unify error codes by replacing -ENOTSUPP with
-EOPNOTSUPP"), our SPI NOR flashes would stop probing with the following
visible in the kernel log:

[    2.196300] brcmstb_qspi f0440920.qspi: using bspi-mspi mode
[    2.210295] spi-nor: probe of spi1.0 failed with error -95

It turns out that the check in spi_mem_exec_op() was changed to check
for -ENOTSUPP (old error code) or -EOPNOTSUPP (new error code), but this
means that for drivers that were converted, the second condition is now
true, and we stop falling through like we used to. Fix the error to
check for neither error being neither -ENOTSUPP *nor* -EOPNOTSUPP.

Fixes: cff49d58f57e ("spi: Unify error codes by replacing -ENOTSUPP with -EOPNOTSUPP")
Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com>
Change-Id: I4159811f6c582c4de2143382473d2000b8755872
---
 drivers/spi/spi-mem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/spi/spi-mem.c b/drivers/spi/spi-mem.c
index 2dc8ceb85374..10b5fa003693 100644
--- a/drivers/spi/spi-mem.c
+++ b/drivers/spi/spi-mem.c
@@ -339,7 +339,7 @@ int spi_mem_exec_op(struct spi_mem *mem, const struct spi_mem_op *op)
 		 * read path) and expect the core to use the regular SPI
 		 * interface in other cases.
 		 */
-		if (!ret || ret != -ENOTSUPP || ret != -EOPNOTSUPP)
+		if (!ret || (ret != -ENOTSUPP && ret != -EOPNOTSUPP))
 			return ret;
 	}
 
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2024-03-15 17:13 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-13 17:10 [PATCH] spi: Fix error code checking in spi_mem_exec_op() Florian Fainelli
2024-03-13 17:33 ` Michael Walle
2024-03-13 17:40   ` Mark Brown
2024-03-13 17:45     ` Florian Fainelli
2024-03-13 19:03     ` Florian Fainelli
2024-03-14 12:58       ` Mark Brown
2024-03-13 18:28   ` Pratyush Yadav
2024-03-13 18:37     ` Florian Fainelli
2024-03-13 19:29       ` Pratyush Yadav
2024-03-13 19:34         ` Florian Fainelli
2024-03-13 20:06           ` Florian Fainelli
2024-03-13 21:15             ` Pratyush Yadav
2024-03-15 17:13 ` Mark Brown

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).