Skip to content

Commit 38780bd

Browse files
committed
Fix bug in am_ao_unsubscribe()
1 parent c2eee72 commit 38780bd

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

libs/ao/ao.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -217,14 +217,13 @@ void am_ao_unsubscribe(const struct am_ao *ao, int event) {
217217
AM_ASSERT(me->aos[ao->prio.ao] == ao);
218218
AM_ASSERT(me->sub);
219219

220-
int ind = event - AM_EVT_USER;
221220
int i = ao->prio.ao / 8;
222221

223222
me->crit_enter();
224223

225-
unsigned list = me->sub[ind].list[i];
224+
unsigned list = me->sub[event].list[i];
226225
list &= ~(1U << (unsigned)(ao->prio.ao % 8));
227-
me->sub[ind].list[i] = (uint8_t)list;
226+
me->sub[event].list[i] = (uint8_t)list;
228227

229228
me->crit_exit();
230229
}

0 commit comments

Comments
 (0)