Skip to contentSkip to conversation

drivers/testing/switchtest: Properly clean up xnthread on error

PATCH In review Jan Kiszka 2 participants 2 messages Oct 7, 2021

lore
Share & tools
lore

Jan Kiszka

author
#0 lore raw

PATCH 1/1 drivers/testing/switchtest: Properly clean up xnthread on error

From: Jan Kiszka <[email protected]>

Analogously to dfb55d64fc0d.

---
 kernel/drivers/testing/switchtest.c | 2 ++
 1 file changed, 2 insertions(+)
kernel/drivers/testing/switchtest.c +2 -0
index 8224974e5c..6f8a9fcaa3 100644
@@ -504,6 +504,8 @@ static int rtswitch_create_ktask(struct rtswitch_context *ctx,
 		sattr.entry = rtswitch_ktask;
 		sattr.cookie = &arg;
 		err = xnthread_start(&task->ktask, &sattr);
+		if (err)
+			__xnthread_discard(&task->ktask);
 	} else
 		/*
 		 * In order to avoid calling xnthread_cancel() for an
Signature · 1 line
2.31.1
#1 lore raw
Quoted 3 lines · Jan Kiszka via Xenomai

From: Jan Kiszka <[email protected]>

Analogously to dfb55d64fc0d.

Seems both qualify for stable.

Quoted 19 lines
---
 kernel/drivers/testing/switchtest.c | 2 ++
 1 file changed, 2 insertions(+)
kernel/drivers/testing/switchtest.c +2 -0
index 8224974e5c..6f8a9fcaa3 100644
@@ -504,6 +504,8 @@ static int rtswitch_create_ktask(struct rtswitch_context *ctx,
 		sattr.entry = rtswitch_ktask;
 		sattr.cookie = &arg;
 		err = xnthread_start(&task->ktask, &sattr);
+		if (err)
+			__xnthread_discard(&task->ktask);
 	} else
 		/*
 		 * In order to avoid calling xnthread_cancel() for an