Skip to content

Commit 7b34456

Browse files
jfischer-nokartben
authored andcommitted
usb: device_next: fix cdc_acm_send_notification()
Fix "warning: 'cdc_acm_send_notification' defined but not used" when Kconfig option UART_USE_RUNTIME_CONFIGURE is not used and properly handle enqueue error. Signed-off-by: Johann Fischer <[email protected]>
1 parent 6522596 commit 7b34456

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

subsys/usb/device_next/class/usbd_cdc_acm.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -513,8 +513,8 @@ static int usbd_cdc_acm_init(struct usbd_class_data *const c_data)
513513
return 0;
514514
}
515515

516-
static int cdc_acm_send_notification(const struct device *dev,
517-
const uint16_t serial_state)
516+
static inline int cdc_acm_send_notification(const struct device *dev,
517+
const uint16_t serial_state)
518518
{
519519
struct cdc_acm_notification notification = {
520520
.bmRequestType = 0xA1,
@@ -549,7 +549,11 @@ static int cdc_acm_send_notification(const struct device *dev,
549549

550550
net_buf_add_mem(buf, &notification, sizeof(struct cdc_acm_notification));
551551
ret = usbd_ep_enqueue(c_data, buf);
552-
/* FIXME: support for sync transfers */
552+
if (ret) {
553+
net_buf_unref(buf);
554+
return ret;
555+
}
556+
553557
k_sem_take(&data->notif_sem, K_FOREVER);
554558

555559
return ret;

0 commit comments

Comments
 (0)