aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/sbi/sbi_sse.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/sbi/sbi_sse.c b/lib/sbi/sbi_sse.c
index 18dfdb6..0cd6ba6 100644
--- a/lib/sbi/sbi_sse.c
+++ b/lib/sbi/sbi_sse.c
@@ -1121,13 +1121,18 @@ void sbi_sse_exit(struct sbi_scratch *scratch)
for (i = 0; i < EVENT_COUNT; i++) {
e = sse_event_get(supported_events[i]);
-
- if (!e || e->attrs.hartid != current_hartid())
+ if (!e)
continue;
+ if (e->attrs.hartid != current_hartid())
+ goto skip;
+
if (sse_event_state(e) > SBI_SSE_STATE_REGISTERED) {
sbi_printf("Event %d in invalid state at exit", i);
sse_event_set_state(e, SBI_SSE_STATE_UNUSED);
}
+
+skip:
+ sse_event_put(e);
}
}