From f66d4a001cd13cf2e3f1261809cb4e1c8fb71224 Mon Sep 17 00:00:00 2001 From: Jukka Laitinen Date: Sun, 14 Sep 2025 10:03:06 +0300 Subject: [PATCH] boards/boardctl: Uninitialize cdcacm by instance number, not direct pointer When uninitializing cdcacm via a boardctl ioctl, use the instance number instead of direct pointer to the driver. The reason for this is, that in CONFIG_BUILD_KERNEL the applications sercon and serdis can't store the pointer; they are separate processes which get killed. The cdcacm driver will search up the driver from the file system when the direct pointer is not given. Signed-off-by: Jukka Laitinen --- boards/boardctl.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/boards/boardctl.c b/boards/boardctl.c index 279347c088a..f784ceb6f26 100644 --- a/boards/boardctl.c +++ b/boards/boardctl.c @@ -133,7 +133,6 @@ static inline int case BOARDIOC_USBDEV_CONNECT: /* Connect the CDC/ACM device */ #ifndef CONFIG_CDCACM_COMPOSITE { - DEBUGASSERT(ctrl->handle != NULL); ret = cdcacm_initialize(ctrl->instance, ctrl->handle); } #endif @@ -141,8 +140,7 @@ static inline int case BOARDIOC_USBDEV_DISCONNECT: /* Disconnect the CDC/ACM device */ { - DEBUGASSERT(ctrl->handle != NULL && *ctrl->handle != NULL); - cdcacm_uninitialize(*ctrl->handle); + ret = cdcacm_uninitialize_instance(ctrl->instance, NULL); } break;