From 2489416ec2a94eecdf20d3b717708651adabfb0d Mon Sep 17 00:00:00 2001 From: Petr Sharshavin Date: Mon, 28 Feb 2022 17:43:53 +0700 Subject: [PATCH] drivers: lora: shell: fix invalid range in config bw param 'bw' parameter in 'lora config' command has a range of 0 to INT8_MAX. However possible values of 'bw' (125, 250, 500) don't fit this range and we need to extend it to 0 to INT16_MAX. This fix has been tested on custom board with STM32L4 and SX1276. Signed-off-by: Petr Sharshavin --- drivers/lora/shell.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/lora/shell.c b/drivers/lora/shell.c index 48288a1da3..692446b06c 100644 --- a/drivers/lora/shell.c +++ b/drivers/lora/shell.c @@ -161,7 +161,7 @@ static int lora_conf_set(const struct shell *sh, const char *param, modem_config.tx_power = lval; } else if (!strcmp("bw", param)) { if (parse_long_range(&lval, sh, value, - "bw", 0, INT8_MAX) < 0) { + "bw", 0, INT16_MAX) < 0) { return -EINVAL; } switch (lval) {