[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 4/9] target/openrisc: Remove dead code attempting to check "is tim
From: |
Peter Maydell |
Subject: |
[PULL 4/9] target/openrisc: Remove dead code attempting to check "is timer disabled" |
Date: |
Tue, 17 Nov 2020 13:48:29 +0000 |
In the mtspr helper we attempt to check for "is the timer disabled"
with "if (env->ttmr & TIMER_NONE)". This is wrong because TIMER_NONE
is zero and the condition is always false (Coverity complains about
the dead code.)
The correct check would be to test whether the TTMR_M field in the
register is equal to TIMER_NONE instead. However, the
cpu_openrisc_timer_update() function checks whether the timer is
enabled (it looks at cpu->env.is_counting, which is set to 0 via
cpu_openrisc_count_stop() when the TTMR_M field is set to
TIMER_NONE), so there's no need to check for "timer disabled" in the
target/openrisc code. Instead, simply remove the dead code.
Fixes: Coverity CID 1005812
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Acked-by: Stafford Horne <shorne@gmail.com>
Message-id: 20201103114654.18540-1-peter.maydell@linaro.org
---
target/openrisc/sys_helper.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/target/openrisc/sys_helper.c b/target/openrisc/sys_helper.c
index d9fe6c59489..41390d046f6 100644
--- a/target/openrisc/sys_helper.c
+++ b/target/openrisc/sys_helper.c
@@ -176,9 +176,6 @@ void HELPER(mtspr)(CPUOpenRISCState *env, target_ulong spr,
target_ulong rb)
case TO_SPR(10, 1): /* TTCR */
cpu_openrisc_count_set(cpu, rb);
- if (env->ttmr & TIMER_NONE) {
- return;
- }
cpu_openrisc_timer_update(cpu);
break;
#endif
--
2.20.1
- [PULL 0/9] target-arm queue, Peter Maydell, 2020/11/17
- [PULL 1/9] hw/arm/virt: ARM_VIRT must select ARM_GIC, Peter Maydell, 2020/11/17
- [PULL 2/9] exynos: Fix bad printf format specifiers, Peter Maydell, 2020/11/17
- [PULL 5/9] register: Remove unnecessary NULL check, Peter Maydell, 2020/11/17
- [PULL 4/9] target/openrisc: Remove dead code attempting to check "is timer disabled",
Peter Maydell <=
- [PULL 3/9] hw/input/ps2.c: Remove remnants of printf debug, Peter Maydell, 2020/11/17
- [PULL 6/9] util/cutils: Fix Coverity array overrun in freq_to_str(), Peter Maydell, 2020/11/17
- [PULL 8/9] hw/misc/tmp105: reset the T_low and T_High registers, Peter Maydell, 2020/11/17
- [PULL 9/9] tmp105: Correct handling of temperature limit checks, Peter Maydell, 2020/11/17
- [PULL 7/9] configure: Make "does libgio work" test pull in some actual functions, Peter Maydell, 2020/11/17
- Re: [PULL 0/9] target-arm queue, no-reply, 2020/11/17
- Re: [PULL 0/9] target-arm queue, Peter Maydell, 2020/11/17