diff options
-rw-r--r-- | src/ethosu_pmu.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/ethosu_pmu.c b/src/ethosu_pmu.c index c1f5c5b..7ca35fc 100644 --- a/src/ethosu_pmu.c +++ b/src/ethosu_pmu.c @@ -78,12 +78,15 @@ enum ethosu_pmu_event_type pmu_event_type(uint32_t id) uint32_t pmu_event_value(enum ethosu_pmu_event_type event) { - if (!(event < ETHOSU_PMU_SENTINEL) || (event < 0)) + int a = event; + if ((a < ETHOSU_PMU_SENTINEL) && (a >= ETHOSU_PMU_NO_EVENT)) + { + return eventbyid[event]; + } + else { return (uint32_t)(-1); } - - return eventbyid[event]; } void ethosu_pmu_driver_init(void) |