Skip to content

Commit 99d36ee

Browse files
Dipendra333lag-linaro
authored andcommitted
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 <[email protected]> Reviewed-by: Pavel Machek <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Lee Jones <[email protected]>
1 parent 09b1ef9 commit 99d36ee

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/leds/leds-bcm6328.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ static void bcm6328_led_mode(struct bcm6328_led *led, unsigned long value)
113113
unsigned long val, shift;
114114

115115
shift = bcm6328_pin2shift(led->pin);
116-
if (shift / 16)
116+
if (shift >= 16)
117117
mode = led->mem + BCM6328_REG_MODE_HI;
118118
else
119119
mode = led->mem + BCM6328_REG_MODE_LO;
@@ -357,7 +357,7 @@ static int bcm6328_led(struct device *dev, struct device_node *nc, u32 reg,
357357
break;
358358
case LEDS_DEFSTATE_KEEP:
359359
shift = bcm6328_pin2shift(led->pin);
360-
if (shift / 16)
360+
if (shift >= 16)
361361
mode = mem + BCM6328_REG_MODE_HI;
362362
else
363363
mode = mem + BCM6328_REG_MODE_LO;

0 commit comments

Comments
 (0)