Bluetooth: shell: Fix missing check for buffer allocation

In practice this allocation is very unlikely to fail, however being
consistent with checking for a failure keeps Coverity happy.

Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
This commit is contained in:
Johan Hedberg 2024-06-24 10:22:20 +03:00 committed by Anas Nashif
commit 63d97c1556

View file

@ -1244,6 +1244,11 @@ static int cmd_hci_cmd(const struct shell *sh, size_t argc, char *argv[])
} }
buf = bt_hci_cmd_create(BT_OP(ogf, ocf), len); buf = bt_hci_cmd_create(BT_OP(ogf, ocf), len);
if (buf == NULL) {
shell_error(sh, "Unable to allocate HCI buffer");
return -ENOMEM;
}
net_buf_add_mem(buf, hex_data, len); net_buf_add_mem(buf, hex_data, len);
} }