Skip to content
Browse files

Bluetooth: hci_uart: Assert if device is NULL

Assert if the UART device is NULL to help with debugging whenever
there's an issue locating the correct UART instance.

Signed-off-by: Carles Cufi <>
  • Loading branch information...
carlescufi committed Jun 20, 2019
1 parent 3b3bbc1 commit d4083b66384cb13ff66ec82115a9345b0864d502
Showing with 2 additions and 0 deletions.
  1. +2 −0 samples/bluetooth/hci_uart/src/main.c
@@ -329,6 +329,7 @@ static int hci_uart_init(struct device *unused)

/* Derived from DT's bt-c2h-uart chosen node */
hci_uart_dev = device_get_binding(CONFIG_BT_CTLR_TO_HOST_UART_DEV_NAME);
if (!hci_uart_dev) {
return -EINVAL;
@@ -354,6 +355,7 @@ void main(void)
int err;

__ASSERT(hci_uart_dev, "UART device is NULL");

/* Enable the raw interface, this will in turn open the HCI driver */

0 comments on commit d4083b6

Please sign in to comment.
You can’t perform that action at this time.