Skip to contentSkip to conversation

hw/timer/imx_epit: fix reported issues

PATCH Applied ~axelheider 2 participants 4 messages Apr 5, 2023 – Apr 11, 2023 Arm i.MX and Layerscape

lore
Share & tools
lore
#0 lore raw

cover hw/timer/imx_epit: fix reported issues

This patchset fixes the following issues:
- variable shadowing reported by Coverity
- fix check, see https://gitlab.com/qemu-project/qemu/-/issues/1491

Axel Heider (2):
hw/timer/imx_epit: don't shadow variable
hw/timer/imx_epit: fix limit check

 hw/timer/imx_epit.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Signature · 1 line
2.38.4
#1 lore raw

PATCH 1/2 hw/timer/imx_epit: don't shadow variable

From: Axel Heider <[email protected]>

Fix issue reported by Coverity.

---
 hw/timer/imx_epit.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/timer/imx_epit.c +1 -1
index 3a869782bc..0821c62cd1 100644
@@ -179,7 +179,7 @@ static void imx_epit_update_compare_timer(IMXEPITState *s)
          * the compare value. Otherwise it may fire at most once in the
          * current round.
          */
-        bool is_oneshot = (limit >= s->cmp);
+        is_oneshot = (limit >= s->cmp);
         if (counter >= s->cmp) {
             /* The compare timer fires in the current round. */
             counter -= s->cmp;
Signature · 1 line
2.38.4
#2 lore raw

PATCH 2/2 hw/timer/imx_epit: fix limit check

In reply to ~axelheider

From: Axel Heider <[email protected]>

Fix the limit check. If the limit is less than the compare value, the timer can never reach this value, thus it will never fire.

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1491

---
 hw/timer/imx_epit.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/timer/imx_epit.c +1 -1
index 0821c62cd1..640e4399c2 100644
@@ -179,7 +179,7 @@ static void imx_epit_update_compare_timer(IMXEPITState *s)
          * the compare value. Otherwise it may fire at most once in the
          * current round.
          */
-        is_oneshot = (limit >= s->cmp);
+        is_oneshot = (limit < s->cmp);
         if (counter >= s->cmp) {
             /* The compare timer fires in the current round. */
             counter -= s->cmp;
Signature · 1 line
2.38.4
#3 lore raw
In reply to ~axelheider
Quoted 11 lines · ~axelheider

This patchset fixes the following issues:
- variable shadowing reported by Coverity
- fix check, see https://gitlab.com/qemu-project/qemu/-/issues/1491

Axel Heider (2):
hw/timer/imx_epit: don't shadow variable
hw/timer/imx_epit: fix limit check

 hw/timer/imx_epit.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Applied to target-arm.next for 8.1, thanks.

-- PMM