diff options
author | William A. Kennington III <william@wkennington.com> | 2023-09-22 11:28:12 -0700 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2023-10-02 15:03:19 +0100 |
commit | 2ec8b010979036c2fe79a64adb6ecc0bd11e91d1 (patch) | |
tree | c4e6878969a99759ff194ffd9f85b62b69df3dba | |
parent | 1a8196a93e493c0a50b800cb09cef60b124eee15 (diff) | |
download | lwn-2ec8b010979036c2fe79a64adb6ecc0bd11e91d1.tar.gz lwn-2ec8b010979036c2fe79a64adb6ecc0bd11e91d1.zip |
spi: npcm-fiu: Fix UMA reads when dummy.nbytes == 0
We don't want to use the value of ilog2(0) as dummy.buswidth is 0 when
dummy.nbytes is 0. Since we have no dummy bytes, we don't need to
configure the dummy byte bits per clock register value anyway.
Signed-off-by: "William A. Kennington III" <william@wkennington.com>
Link: https://lore.kernel.org/r/20230922182812.2728066-1-william@wkennington.com
Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r-- | drivers/spi/spi-npcm-fiu.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/spi/spi-npcm-fiu.c b/drivers/spi/spi-npcm-fiu.c index 0ca21ff0e9cc..e42248519688 100644 --- a/drivers/spi/spi-npcm-fiu.c +++ b/drivers/spi/spi-npcm-fiu.c @@ -353,8 +353,9 @@ static int npcm_fiu_uma_read(struct spi_mem *mem, uma_cfg |= ilog2(op->cmd.buswidth); uma_cfg |= ilog2(op->addr.buswidth) << NPCM_FIU_UMA_CFG_ADBPCK_SHIFT; - uma_cfg |= ilog2(op->dummy.buswidth) - << NPCM_FIU_UMA_CFG_DBPCK_SHIFT; + if (op->dummy.nbytes) + uma_cfg |= ilog2(op->dummy.buswidth) + << NPCM_FIU_UMA_CFG_DBPCK_SHIFT; uma_cfg |= ilog2(op->data.buswidth) << NPCM_FIU_UMA_CFG_RDBPCK_SHIFT; uma_cfg |= op->dummy.nbytes << NPCM_FIU_UMA_CFG_DBSIZ_SHIFT; |