spi: Add error checking for invalid bus widths
authorSimon Glass <sjg@chromium.org>
Wed, 30 Nov 2016 03:00:13 +0000 (20:00 -0700)
committerJagan Teki <jagan@amarulasolutions.com>
Thu, 15 Dec 2016 15:38:30 +0000 (16:38 +0100)
At present an invalid bus width prints a message but does not return an
error. This is the opposite of the correct behaviour. Adjust it to avoid
code bloat in the common case, and avoid hard-to-debug failure in the
uncommon case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Jagan Teki <jagan@openedev.com>
drivers/spi/spi-uclass.c

index f59a70173c41ace0b05c6ae805657f26c11bb496..1ab5b75fa1fc642a3971a58625ddca0a9c70d381 100644 (file)
@@ -418,7 +418,7 @@ int spi_slave_ofdata_to_platdata(const void *blob, int node,
                mode |= SPI_TX_QUAD;
                break;
        default:
-               error("spi-tx-bus-width %d not supported\n", value);
+               warn_non_spl("spi-tx-bus-width %d not supported\n", value);
                break;
        }
 
@@ -433,7 +433,7 @@ int spi_slave_ofdata_to_platdata(const void *blob, int node,
                mode |= SPI_RX_QUAD;
                break;
        default:
-               error("spi-rx-bus-width %d not supported\n", value);
+               warn_non_spl("spi-rx-bus-width %d not supported\n", value);
                break;
        }