summaryrefslogtreecommitdiff
path: root/drivers/spi
diff options
context:
space:
mode:
authorWilliam A. Kennington III <william@wkennington.com>2023-09-22 21:28:12 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-11-08 19:30:48 +0300
commit66cc633fc6e1a8229c3adc3e3939335f9af90b3e (patch)
treee518c36def8190cb57c6b5e4adef418515d82e01 /drivers/spi
parent6f9093b6f8f76376cac1c262560524d7a0a8bee9 (diff)
downloadlinux-66cc633fc6e1a8229c3adc3e3939335f9af90b3e.tar.xz
spi: npcm-fiu: Fix UMA reads when dummy.nbytes == 0
[ Upstream commit 2ec8b010979036c2fe79a64adb6ecc0bd11e91d1 ] 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> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/spi')
-rw-r--r--drivers/spi/spi-npcm-fiu.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/spi/spi-npcm-fiu.c b/drivers/spi/spi-npcm-fiu.c
index b62471ab6d7f..1edaf22e265b 100644
--- a/drivers/spi/spi-npcm-fiu.c
+++ b/drivers/spi/spi-npcm-fiu.c
@@ -334,8 +334,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;