Bluetooth: Shell: Workaround coverity uint comparation
The current code triggers a false positive from the heuristic "Macro compares unsigned to 0". It's triggered because of a use of `IN_RANGE` that checks against the extremal values of a enum type. This patch replaces the use of `IN_RANGE` with an explicit list of the possible values of the enum. Fixes: https://github.com/zephyrproject-rtos/zephyr/issues/65575 Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
This commit is contained in:
parent
fd8ac9e6cd
commit
d3a0c769b0
1 changed files with 6 additions and 3 deletions
|
@ -4071,9 +4071,12 @@ static int cmd_auth_passkey_notify(const struct shell *sh,
|
|||
|
||||
err = 0;
|
||||
type = shell_strtoul(argv[1], 0, &err);
|
||||
if (err || !IN_RANGE(type, BT_CONN_AUTH_KEYPRESS_ENTRY_STARTED,
|
||||
BT_CONN_AUTH_KEYPRESS_ENTRY_COMPLETED)) {
|
||||
shell_error(sh, "<type> must be a value in range of enum bt_conn_auth_keypress");
|
||||
if (err ||
|
||||
(type != BT_CONN_AUTH_KEYPRESS_ENTRY_STARTED &&
|
||||
type != BT_CONN_AUTH_KEYPRESS_DIGIT_ENTERED &&
|
||||
type != BT_CONN_AUTH_KEYPRESS_DIGIT_ERASED && type != BT_CONN_AUTH_KEYPRESS_CLEARED &&
|
||||
type != BT_CONN_AUTH_KEYPRESS_ENTRY_COMPLETED)) {
|
||||
shell_error(sh, "<type> must be a value of enum bt_conn_auth_keypress");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue