From: Dipendra Khadka <kdipendra88@gmail.com>
To: lee@kernel.org, pavel@ucw.cz
Cc: Dipendra Khadka <kdipendra88@gmail.com>,
linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH v2] leds: bcm6328: Replace divide condition with comparison for shift value
Date: Sat, 19 Oct 2024 07:33:01 +0000 [thread overview]
Message-ID: <20241019073302.35499-1-kdipendra88@gmail.com> (raw)
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>
---
v2:
- Changed the patch subject as suggested
- Changed the patch description
v1: https://lore.kernel.org/all/20240922174020.49856-1-kdipendra88@gmail.com/
drivers/leds/leds-bcm6328.c | 4 ++--
1 file 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;
--
2.43.0
next reply other threads:[~2024-10-19 7:33 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-19 7:33 Dipendra Khadka [this message]
2024-10-31 16:10 ` (subset) [PATCH v2] leds: bcm6328: Replace divide condition with comparison for shift value Lee Jones
2024-11-23 19:55 ` Andy Shevchenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241019073302.35499-1-kdipendra88@gmail.com \
--to=kdipendra88@gmail.com \
--cc=lee@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-leds@vger.kernel.org \
--cc=pavel@ucw.cz \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox