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:
parent
de2efdee97
commit
63d97c1556
1 changed files with 5 additions and 0 deletions
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue