Commit 3e799ccd authored by Lee Jones's avatar Lee Jones

backlight: lm3630a_bl: Remove invalid checks for unsigned int < 0

unsigned ints 'sources' and 'bank' cannot be less than LM3630A_SINK_0 (0)
and LM3630A_BANK_0 (0) respecitively, so change the logic to only check
for thier two possible valid values.

Fixes W=1 warnings:

 drivers/video/backlight/lm3630a_bl.c: In function ‘lm3630a_parse_led_sources’:
 drivers/video/backlight/lm3630a_bl.c:394:18: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits]
 394 | if (sources[i] < LM3630A_SINK_0 || sources[i] > LM3630A_SINK_1)
 | ^
 drivers/video/backlight/lm3630a_bl.c: In function ‘lm3630a_parse_bank’:
 drivers/video/backlight/lm3630a_bl.c:415:11: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits]
 415 | if (bank < LM3630A_BANK_0 || bank > LM3630A_BANK_1)
 | ^

Cc: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Cc: Daniel Jeong <gshark.jeong@gmail.com>
Cc: LDD MLP <ldd-mlp@list.ti.com>
Signed-off-by: default avatarLee Jones <lee.jones@linaro.org>
Reviewed-by: default avatarDaniel Thompson <daniel.thompson@linaro.org>
Reviewed-by: default avatarSam Ravnborg <sam@ravnborg.org>
Signed-off-by: default avatarLee Jones <lee.jones@linaro.org>
parent 6c05632d
...@@ -391,7 +391,7 @@ static int lm3630a_parse_led_sources(struct fwnode_handle *node, ...@@ -391,7 +391,7 @@ static int lm3630a_parse_led_sources(struct fwnode_handle *node,
return ret; return ret;
for (i = 0; i < num_sources; i++) { for (i = 0; i < num_sources; i++) {
if (sources[i] < LM3630A_SINK_0 || sources[i] > LM3630A_SINK_1) if (sources[i] != LM3630A_SINK_0 && sources[i] != LM3630A_SINK_1)
return -EINVAL; return -EINVAL;
ret |= BIT(sources[i]); ret |= BIT(sources[i]);
...@@ -412,7 +412,7 @@ static int lm3630a_parse_bank(struct lm3630a_platform_data *pdata, ...@@ -412,7 +412,7 @@ static int lm3630a_parse_bank(struct lm3630a_platform_data *pdata,
if (ret) if (ret)
return ret; return ret;
if (bank < LM3630A_BANK_0 || bank > LM3630A_BANK_1) if (bank != LM3630A_BANK_0 && bank != LM3630A_BANK_1)
return -EINVAL; return -EINVAL;
led_sources = lm3630a_parse_led_sources(node, BIT(bank)); led_sources = lm3630a_parse_led_sources(node, BIT(bank));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment