diff options
author | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2021-07-21 15:15:20 +0300 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2021-07-22 12:41:19 +0100 |
commit | e3aa9acc71778266cc4743217ff1a1a53caf15d6 (patch) | |
tree | e4d1d4dd925f38433ebc66ad01bbdb4e5cd0fc25 /drivers/spi | |
parent | cfb4dac1296472a75ec8ae813c9ab8764bbb0ca2 (diff) | |
download | linux-e3aa9acc71778266cc4743217ff1a1a53caf15d6.tar.bz2 |
spi: pxa2xx: Adapt reset_sccr1() to the case when no message available
In some cases reset_sccr1() can be called when no message available.
This means that there is no associated chip to receive that message
and hence no threshold needs to be set. Adapt the function to such
cases.
Fixes: 3bbdc083262d ("spi: pxa2xx: Reuse int_stop_and_reset() in couple of places")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20210721121520.62605-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/spi')
-rw-r--r-- | drivers/spi/spi-pxa2xx.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c index 19a2d1ea7d42..1573f6d8eb48 100644 --- a/drivers/spi/spi-pxa2xx.c +++ b/drivers/spi/spi-pxa2xx.c @@ -594,8 +594,15 @@ static int u32_reader(struct driver_data *drv_data) static void reset_sccr1(struct driver_data *drv_data) { - struct chip_data *chip = spi_get_ctldata(drv_data->controller->cur_msg->spi); - u32 mask = drv_data->int_cr1 | drv_data->dma_cr1; + u32 mask = drv_data->int_cr1 | drv_data->dma_cr1, threshold; + struct chip_data *chip; + + if (drv_data->controller->cur_msg) { + chip = spi_get_ctldata(drv_data->controller->cur_msg->spi); + threshold = chip->threshold; + } else { + threshold = 0; + } switch (drv_data->ssp_type) { case QUARK_X1000_SSP: @@ -609,7 +616,7 @@ static void reset_sccr1(struct driver_data *drv_data) break; } - pxa2xx_spi_update(drv_data, SSCR1, mask, chip->threshold); + pxa2xx_spi_update(drv_data, SSCR1, mask, threshold); } static void int_stop_and_reset(struct driver_data *drv_data) |