From 0a502562c3e9d51e05a19a2f509ad9ab4b496091 Mon Sep 17 00:00:00 2001 From: James Prestwood Date: Mon, 23 Oct 2023 05:20:54 -0700 Subject: [PATCH] offchannel: Use roc id in offchannel_cancel lookup Instead of looking up by wdev, lookup by the ID itself. We shouldn't ever have more than one info per wdev in the queue but looking up the _exact_ info structure doesn't hurt in case things change in the future. --- src/offchannel.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/offchannel.c b/src/offchannel.c index b9cdc117..77d27636 100644 --- a/src/offchannel.c +++ b/src/offchannel.c @@ -65,6 +65,14 @@ static bool match_wdev(const void *a, const void *user_data) return info->wdev_id == *wdev_id; } +static bool match_id(const void *a, const void *user_data) +{ + const struct offchannel_info *info = a; + uint32_t id = L_PTR_TO_UINT(user_data); + + return id == info->work.id; +} + static void offchannel_cancel_roc(struct offchannel_info *info) { struct l_genl_msg *msg; @@ -191,7 +199,8 @@ void offchannel_cancel(uint64_t wdev_id, uint32_t id) else if (ret == false) goto work_done; - info = l_queue_find(offchannel_list, match_wdev, &wdev_id); + + info = l_queue_find(offchannel_list, match_id, L_UINT_TO_PTR(id)); if (!info) return;