diff options
author | Clark Wang <xiaoning.wang@nxp.com> | 2019-03-06 09:30:47 +0300 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2019-03-18 15:17:59 +0300 |
commit | 578465ea2b4b56368ddc3dcefb1f6d607382ef86 (patch) | |
tree | 3970243919d7fec5d78d1b3259d276658ead8668 /drivers/spi/spi-fsl-lpspi.c | |
parent | 09c04466ce7ea494993c0635ba5edb6d2222a806 (diff) | |
download | linux-578465ea2b4b56368ddc3dcefb1f6d607382ef86.tar.xz |
spi: lpspi: Add the missing NULL check
The spi_transfer *t will be used in one transfer whatever. If t is NULL,
there has no need to try sending data, so add an error return here.
Signed-off-by: Clark Wang <xiaoning.wang@nxp.com>
Acked-by: Fugang Duan <Fugang.duan@nxp.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/spi/spi-fsl-lpspi.c')
-rw-r--r-- | drivers/spi/spi-fsl-lpspi.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/spi/spi-fsl-lpspi.c b/drivers/spi/spi-fsl-lpspi.c index 9ff32fb67a29..2ac3ac5ea50a 100644 --- a/drivers/spi/spi-fsl-lpspi.c +++ b/drivers/spi/spi-fsl-lpspi.c @@ -438,9 +438,12 @@ static int fsl_lpspi_setup_transfer(struct spi_controller *controller, struct fsl_lpspi_data *fsl_lpspi = spi_controller_get_devdata(spi->controller); + if (t == NULL) + return -EINVAL; + fsl_lpspi->config.mode = spi->mode; - fsl_lpspi->config.bpw = t ? t->bits_per_word : spi->bits_per_word; - fsl_lpspi->config.speed_hz = t ? t->speed_hz : spi->max_speed_hz; + fsl_lpspi->config.bpw = t->bits_per_word; + fsl_lpspi->config.speed_hz = t->speed_hz; fsl_lpspi->config.chip_select = spi->chip_select; if (!fsl_lpspi->config.speed_hz) |