Staging: leds: replace divide condition 'shift / 16' with 'shift >= 16'
PATCH 1/1 Staging: leds: replace divide condition 'shift / 16' with 'shift >= 16'
Smatch reported following:
'''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' '''
Replacing 'shift / 16' with 'shift >= 16'.
--- drivers/leds/leds-bcm6328.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/leds/leds-bcm6328.c +2 -2
@@ -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 ;
Signature · 1 line
2.43.0
Quoted 8 lines · Dipendra Khadka
Smatch reported following:
'''drivers/leds/leds-bcm6328.c:116bcm6328_led_mode()warn: replace divide condition 'shift / 16' with 'shift >= 16'drivers/leds/leds-bcm6328.c:360bcm6328_led()warn: replace divide condition 'shift / 16' with 'shift >= 16' '''
Replacing 'shift / 16' with 'shift >= 16'.Signed-off-by Dipendra Khadka <[email protected]>
BR,
Pavel
Signature · 1 line
People of Russia, stop Putin before his war on Ukraine escalates.
Lee Jones
maintainerStaging! Why Staging?
Quoted 6 lines · Dipendra Khadka
Smatch reported following:
'''drivers/leds/leds-bcm6328.c:116bcm6328_led_mode()warn: replace divide condition 'shift / 16' with 'shift >= 16'drivers/leds/leds-bcm6328.c:360bcm6328_led()warn: replace divide condition 'shift / 16' with 'shift >= 16' '''
Replacing 'shift / 16' with 'shift >= 16'.
More info please.
- What is the current problem you're attempting to solve?
- How does this patch help with that?
- What are the consequences for not applying this fix?
Quoted 31 lines
Signed-off-by Dipendra Khadka <[email protected]>--- drivers/leds/leds-bcm6328.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/leds/leds-bcm6328.c +2
-2@@ -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 ;Signature · 1 line
2.43.0
Signature · 1 line
Lee Jones [李琼斯]
Pavel Machek
Reviewed-byHi!
Quoted 11 lines
Staging! Why Staging?
Quoted 6 lines · Dipendra Khadka
Smatch reported following:
'''drivers/leds/leds-bcm6328.c:116bcm6328_led_mode()warn: replace divide condition 'shift / 16' with 'shift >= 16'drivers/leds/leds-bcm6328.c:360bcm6328_led()warn: replace divide condition 'shift / 16' with 'shift >= 16' '''
Replacing 'shift / 16' with 'shift >= 16'.
Quoted 5 lines
More info please.
- What is the current problem you're attempting to solve?
- How does this patch help with that?
- What are the consequences for not applying this fix?
Take a look at patch. Doing shift / 16 when testing on >= 16 is just ugly. It is simple cleanup.
Best regards,
Pavel
Quoted 23 lines
Quoted 22 lines
drivers/leds/leds-bcm6328.c +2
-2@@ -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 ;Signature · 1 line
2.43.0
Signature · 1 line
People of Russia, stop Putin before his war on Ukraine escalates.
Lee Jones
maintainerQuoted 13 lines · Pavel Machek
Hi!
Quoted 11 lines
Staging! Why Staging?
Quoted 6 lines · Dipendra Khadka
Smatch reported following:
'''drivers/leds/leds-bcm6328.c:116bcm6328_led_mode()warn: replace divide condition 'shift / 16' with 'shift >= 16'drivers/leds/leds-bcm6328.c:360bcm6328_led()warn: replace divide condition 'shift / 16' with 'shift >= 16' '''
Replacing 'shift / 16' with 'shift >= 16'.
Quoted 8 lines
Quoted 5 lines
More info please.
- What is the current problem you're attempting to solve?
- How does this patch help with that?
- What are the consequences for not applying this fix?Take a look at patch. Doing shift / 16 when testing on >= 16 is just ugly. It is simple cleanup.
You missed the point of the comments.
Copying / pasting the warning into the subject-line and commit message without any additional wordage is sub-optimal. Please improve the commit message.
Signature · 1 line
Lee Jones [李琼斯]
Hi,
Quoted 22 lines · Lee Jones
Quoted 19 lines · Pavel Machek
Hi!
Quoted 16 lines
Staging! Why Staging?
Quoted 6 lines · Dipendra Khadka
Smatch reported following:
'''drivers/leds/leds-bcm6328.c:116bcm6328_led_mode()warn: replace divide condition 'shift / 16' with 'shift >= 16'drivers/leds/leds-bcm6328.c:360bcm6328_led()warn: replace divide condition 'shift / 16' with 'shift >= 16' '''
Replacing 'shift / 16' with 'shift >= 16'.More info please.
- What is the current problem you're attempting to solve?
- How does this patch help with that?
- What are the consequences for not applying this fix?
Quoted 9 lines
Quoted 2 lines
Take a look at patch. Doing shift / 16 when testing on >= 16 is just ugly. It is simple cleanup.
You missed the point of the comments.
Copying / pasting the warning into the subject-line and commit message without any additional wordage is sub-optimal. Please improve the commit message.
Sure, I will send a v2 for this.
Quoted 2 lines
--
Lee Jones [李琼斯]
Best regards,
Dipendra Khadka