summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDipendra Khadka <kdipendra88@gmail.com>2024-10-19 07:33:01 +0000
committerLee Jones <lee@kernel.org>2024-10-31 16:22:23 +0000
commit99d36eed05e735105e89e0a18877518c08618e52 (patch)
tree56145b37732829aaab299c7845ba787825eb86cb
parent09b1ef9813a0742674f7efe26104403ca94a1b4a (diff)
downloadlwn-99d36eed05e735105e89e0a18877518c08618e52.tar.gz
lwn-99d36eed05e735105e89e0a18877518c08618e52.zip
leds: bcm6328: Replace divide condition with comparison for shift value
Fixes the following Smatch warnings: drivers/leds/leds-bcm6328.c:116 bcm6328_led_mode() warn: replace divide condition 'shift / 16' with 'shift >= 16' drivers/leds/leds-bcm6328.c:360 bcm6328_led() warn: replace divide condition 'shift / 16' with 'shift >= 16' Signed-off-by: Dipendra Khadka <kdipendra88@gmail.com> Reviewed-by: Pavel Machek <pavel@ucw.cz> Link: https://lore.kernel.org/r/20241019073302.35499-1-kdipendra88@gmail.com Signed-off-by: Lee Jones <lee@kernel.org>
-rw-r--r--drivers/leds/leds-bcm6328.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/leds/leds-bcm6328.c b/drivers/leds/leds-bcm6328.c
index 29f5bad61796..592bbf4b7e35 100644
--- a/drivers/leds/leds-bcm6328.c
+++ b/drivers/leds/leds-bcm6328.c
@@ -113,7 +113,7 @@ static void bcm6328_led_mode(struct bcm6328_led *led, unsigned long value)
unsigned long val, shift;
shift = bcm6328_pin2shift(led->pin);
- if (shift / 16)
+ if (shift >= 16)
mode = led->mem + BCM6328_REG_MODE_HI;
else
mode = led->mem + BCM6328_REG_MODE_LO;
@@ -357,7 +357,7 @@ static int bcm6328_led(struct device *dev, struct device_node *nc, u32 reg,
break;
case LEDS_DEFSTATE_KEEP:
shift = bcm6328_pin2shift(led->pin);
- if (shift / 16)
+ if (shift >= 16)
mode = mem + BCM6328_REG_MODE_HI;
else
mode = mem + BCM6328_REG_MODE_LO;