diff options
author | Heinrich Schuchardt <xypron.glpk@gmx.de> | 2018-03-18 12:41:43 +0100 |
---|---|---|
committer | Jagan Teki <jagan@amarulasolutions.com> | 2018-05-16 19:18:41 +0530 |
commit | 8fad5e0b114fdd4c4e8d5f105ea3527df2c83986 (patch) | |
tree | 629170d1614804b65e18f73a0de9457b0a93964d /drivers/spi | |
parent | 4eaa2fa16968359ffcf207e63848ed7f3a6e4309 (diff) |
spi: atcspi200: avoid NULL dereference
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>
Diffstat (limited to 'drivers/spi')
-rw-r--r-- | drivers/spi/atcspi200_spi.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/spi/atcspi200_spi.c b/drivers/spi/atcspi200_spi.c index 2c1d36ee67..6233d4978f 100644 --- a/drivers/spi/atcspi200_spi.c +++ b/drivers/spi/atcspi200_spi.c @@ -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; |