]> git.sur5r.net Git - u-boot/commitdiff
spi: atcspi200: avoid NULL dereference
authorHeinrich Schuchardt <xypron.glpk@gmx.de>
Sun, 18 Mar 2018 11:41:43 +0000 (12:41 +0100)
committerJagan Teki <jagan@amarulasolutions.com>
Wed, 16 May 2018 13:48:41 +0000 (19:18 +0530)
For SPI_XFER_BEGIN | SPI_XFER_END the code sets data_out = NULL.
In the debug statement we should not dereference this value.
As we do not transfer any data the debug statement is not needed in this
case anyway.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Jagan Teki <jagan@openedev.com>
drivers/spi/atcspi200_spi.c

index 2c1d36ee6737477796ac3bdba78fac3bba43700f..6233d4978f5395f7e7fa3c959267ac3ec65dda53 100644 (file)
@@ -229,8 +229,10 @@ static int __atcspi200_spi_xfer(struct nds_spi_slave *ns,
                        __atcspi200_spi_start(ns);
                        break;
                }
-               debug("spi_xfer: data_out %08X(%p) data_in %08X(%p) data_len %u\n",
-                     *(uint *)data_out, data_out, *(uint *)data_in, data_in, data_len);
+               if (data_out)
+                       debug("spi_xfer: data_out %08X(%p) data_in %08X(%p) data_len %u\n",
+                             *(uint *)data_out, data_out, *(uint *)data_in,
+                             data_in, data_len);
                num_chunks = DIV_ROUND_UP(data_len, max_tran_len);
                din = data_in;
                dout = data_out;