From: Lee Jones Date: Tue, 23 Jun 2020 14:37:50 +0000 (+0100) Subject: backlight: lm3630a_bl: Remove invalid checks for unsigned int < 0 X-Git-Tag: v5.15~3125^2~22 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3e799ccda3651a43ef3b366f70101e16e5054865;p=platform%2Fkernel%2Flinux-starfive.git 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 Cc: Daniel Jeong Cc: LDD MLP Signed-off-by: Lee Jones Reviewed-by: Daniel Thompson Reviewed-by: Sam Ravnborg Signed-off-by: Lee Jones --- diff --git a/drivers/video/backlight/lm3630a_bl.c b/drivers/video/backlight/lm3630a_bl.c index ee32088..e88a2b0 100644 --- a/drivers/video/backlight/lm3630a_bl.c +++ b/drivers/video/backlight/lm3630a_bl.c @@ -391,7 +391,7 @@ static int lm3630a_parse_led_sources(struct fwnode_handle *node, return ret; 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; ret |= BIT(sources[i]); @@ -412,7 +412,7 @@ static int lm3630a_parse_bank(struct lm3630a_platform_data *pdata, if (ret) return ret; - if (bank < LM3630A_BANK_0 || bank > LM3630A_BANK_1) + if (bank != LM3630A_BANK_0 && bank != LM3630A_BANK_1) return -EINVAL; led_sources = lm3630a_parse_led_sources(node, BIT(bank));