public inbox for iwd@lists.linux.dev
 help / color / mirror / Atom feed
* [PATCH 2/2] offchannel: always call destroy right away on cancel
@ 2021-12-15 17:41 James Prestwood
  0 siblings, 0 replies; only message in thread
From: James Prestwood @ 2021-12-15 17:41 UTC (permalink / raw)
  To: iwd 

[-- Attachment #1: Type: text/plain, Size: 1269 bytes --]

The main cancel code path was not calling destroy immediately which
was not consistent with other code paths/APIs.
---
 src/offchannel.c | 22 ++++++++++------------
 1 file changed, 10 insertions(+), 12 deletions(-)

diff --git a/src/offchannel.c b/src/offchannel.c
index ad35f4f6..4db3fcf2 100644
--- a/src/offchannel.c
+++ b/src/offchannel.c
@@ -208,20 +208,10 @@ void offchannel_cancel(uint64_t wdev_id, uint32_t id)
 			goto work_done;
 		}
 
-		/*
-		 * Call destroy now to maintain consistency with any other
-		 * path leading to radio_work_done(). But set needs_cancel so
-		 * the ROC command can be canceled
-		 */
-		if (info->destroy)
-			info->destroy(info->error, info->user_data);
-
-		info->destroy = NULL;
-		info->started = NULL;
-		info->user_data = NULL;
+		/* Lets the ROC callback know it needs to cancel the request */
 		info->needs_cancel = true;
 
-		return;
+		goto destroy;
 	}
 
 	/*
@@ -239,6 +229,14 @@ void offchannel_cancel(uint64_t wdev_id, uint32_t id)
 	 */
 	offchannel_cancel_roc(info);
 
+destroy:
+	if (info->destroy)
+		info->destroy(info->error, info->user_data);
+
+	info->destroy = NULL;
+	info->started = NULL;
+	info->user_data = NULL;
+
 	return;
 
 work_done:
-- 
2.31.1

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2021-12-15 17:41 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-12-15 17:41 [PATCH 2/2] offchannel: always call destroy right away on cancel James Prestwood

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox