From: Colin Ian King <colin.k...@canonical.com>

Currently the failure check on dtc->irq is always false because
dtc->irq is an unsigned int. Fix this by using a temporary signed
int for the less than zero error check.

Addresses-Coverity: ("Unsigned compared against 0")
Fixes: 0ba64770a2f2 ("perf: Add Arm CMN-600 PMU driver")
Signed-off-by: Colin Ian King <colin.k...@canonical.com>
---
 drivers/perf/arm-cmn.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/perf/arm-cmn.c b/drivers/perf/arm-cmn.c
index a76ff594f3ca..21819af163f3 100644
--- a/drivers/perf/arm-cmn.c
+++ b/drivers/perf/arm-cmn.c
@@ -1246,11 +1246,13 @@ static int arm_cmn_init_dtc(struct arm_cmn *cmn, struct 
arm_cmn_node *dn, int id
 {
        struct arm_cmn_dtc *dtc = cmn->dtc + idx;
        struct arm_cmn_node *xp;
+       int irq;
 
        dtc->base = dn->pmu_base - CMN_PMU_OFFSET;
-       dtc->irq = platform_get_irq(to_platform_device(cmn->dev), idx);
-       if (dtc->irq < 0)
-               return dtc->irq;
+       irq = platform_get_irq(to_platform_device(cmn->dev), idx);
+       if (irq < 0)
+               return irq;
+       dtc->irq = irq;
 
        writel_relaxed(0, dtc->base + CMN_DT_PMCR);
        writel_relaxed(0x1ff, dtc->base + CMN_DT_PMOVSR_CLR);
-- 
2.27.0

Reply via email to