Skip to content

Commit fd5ac97

Browse files
Fabrice GasnierWilliam Breathitt Gray
authored andcommitted
counter: stm32-lptimer-cnt: fix the check on arr and cmp registers update
The ARR (auto reload register) and CMP (compare) registers are successively written. The status bits to check the update of these registers are polled together with regmap_read_poll_timeout(). The condition to end the loop may become true, even if one of the register isn't correctly updated. So ensure both status bits are set before clearing them. Fixes: d895882 ("iio: counter: Add support for STM32 LPTimer") Signed-off-by: Fabrice Gasnier <[email protected]> Link: https://lore.kernel.org/r/[email protected]/ Signed-off-by: William Breathitt Gray <[email protected]>
1 parent 30a0b95 commit fd5ac97

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/counter/stm32-lptimer-cnt.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ static int stm32_lptim_set_enable_state(struct stm32_lptim_cnt *priv,
6969

7070
/* ensure CMP & ARR registers are properly written */
7171
ret = regmap_read_poll_timeout(priv->regmap, STM32_LPTIM_ISR, val,
72-
(val & STM32_LPTIM_CMPOK_ARROK),
72+
(val & STM32_LPTIM_CMPOK_ARROK) == STM32_LPTIM_CMPOK_ARROK,
7373
100, 1000);
7474
if (ret)
7575
return ret;

0 commit comments

Comments
 (0)