Skip to contentSkip to conversation

leds: cht-wcove: Fix an unsigned comparison which can never be negative

PATCH Applied Yang Li 2 participants 2 messages May 31, 2023 – Jun 8, 2023 LED

lore
Share & tools
lore

Yang Li

author
#0 lore raw

PATCH 1/1 leds: cht-wcove: Fix an unsigned comparison which can never be negative

The return value from the call to cht_wc_leds_find_freq() is int. However, the return value is being assigned to an unsigned int variable 'ctrl', so making it an int.

Eliminate the following warning:
drivers/leds/leds-cht-wcove.c:236 cht_wc_leds_set_effect() warn: unsigned 'ctrl' is never less than zero.

---
 drivers/leds/leds-cht-wcove.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/leds/leds-cht-wcove.c +1 -2
index 0cfebee98910..10afd03164b4 100644
@@ -223,8 +223,7 @@ static int cht_wc_leds_set_effect(struct led_classdev *cdev,
 				  u8 effect)
 {
 	struct cht_wc_led *led = container_of(cdev, struct cht_wc_led, cdev);
-	unsigned int ctrl;
-	int ret;
+	int ctrl, ret;
 
 	mutex_lock(&led->mutex);
 
Signature · 1 line
2.20.1.7.g153144c
maintainer Applied
#1 lore raw
Quoted 7 lines · Yang Li

The return value from the call to cht_wc_leds_find_freq() is int. However, the return value is being assigned to an unsigned int variable 'ctrl', so making it an int.

Eliminate the following warning:
drivers/leds/leds-cht-wcove.c:236 cht_wc_leds_set_effect() warn: unsigned 'ctrl' is never less than zero.

Quoted 6 lines
---
 drivers/leds/leds-cht-wcove.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Applied, thanks

Signature · 1 line
Lee Jones [李琼斯]