summaryrefslogtreecommitdiffstats
path: root/drivers/spi/spi-cadence-quadspi.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/spi/spi-cadence-quadspi.c')
-rw-r--r--drivers/spi/spi-cadence-quadspi.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/spi/spi-cadence-quadspi.c b/drivers/spi/spi-cadence-quadspi.c
index 7a00346ff9b9..13d1f0ce618e 100644
--- a/drivers/spi/spi-cadence-quadspi.c
+++ b/drivers/spi/spi-cadence-quadspi.c
@@ -307,11 +307,13 @@ static unsigned int cqspi_calc_rdreg(struct cqspi_flash_pdata *f_pdata)
static unsigned int cqspi_calc_dummy(const struct spi_mem_op *op, bool dtr)
{
- unsigned int dummy_clk;
+ unsigned int dummy_clk = 0;
- dummy_clk = op->dummy.nbytes * (8 / op->dummy.buswidth);
- if (dtr)
- dummy_clk /= 2;
+ if (op->dummy.buswidth && op->dummy.nbytes) {
+ dummy_clk = op->dummy.nbytes * (8 / op->dummy.buswidth);
+ if (dtr)
+ dummy_clk /= 2;
+ }
return dummy_clk;
}