Skip to content

Commit 29895ce

Browse files
ffainellibroonie
authored andcommitted
spi: Fix error code checking in spi_mem_exec_op()
After commit cff49d5 ("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: cff49d5 ("spi: Unify error codes by replacing -ENOTSUPP with -EOPNOTSUPP") Reviewed-by: Michael Walle <[email protected]> Reviewed-by: Pratyush Yadav <[email protected]> Signed-off-by: Florian Fainelli <[email protected]> Reviewed-by: Miquel Raynal <[email protected]> Reviewed-by: Mika Westerberg <[email protected]> Reviewed-by: Tudor Ambarus <[email protected]> Link: https://msgid.link/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent aa0162d commit 29895ce

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/spi/spi-mem.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ int spi_mem_exec_op(struct spi_mem *mem, const struct spi_mem_op *op)
382382
* read path) and expect the core to use the regular SPI
383383
* interface in other cases.
384384
*/
385-
if (!ret || ret != -ENOTSUPP || ret != -EOPNOTSUPP) {
385+
if (!ret || (ret != -ENOTSUPP && ret != -EOPNOTSUPP)) {
386386
spi_mem_add_op_stats(ctlr->pcpu_statistics, op, ret);
387387
spi_mem_add_op_stats(mem->spi->pcpu_statistics, op, ret);
388388

0 commit comments

Comments
 (0)