* [PATCH] hwmon: (adm1031): Remove redundant assignment to variable range
@ 2021-12-04 23:31 Colin Ian King
2021-12-07 17:30 ` Guenter Roeck
0 siblings, 1 reply; 2+ messages in thread
From: Colin Ian King @ 2021-12-04 23:31 UTC (permalink / raw)
To: Jean Delvare, Guenter Roeck, linux-hwmon; +Cc: kernel-janitors, linux-kernel
Variable range is being initialized with a value that is never read, it
is being re-assigned in the next statement. The assignment is redundant,
remove it and initialize range using the second assigned value. Clean up
the formatting too by adding missing spaces.
Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
---
drivers/hwmon/adm1031.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/hwmon/adm1031.c b/drivers/hwmon/adm1031.c
index 257ec53ae723..ac841fa3a369 100644
--- a/drivers/hwmon/adm1031.c
+++ b/drivers/hwmon/adm1031.c
@@ -242,9 +242,8 @@ static int FAN_TO_REG(int reg, int div)
static int AUTO_TEMP_MAX_TO_REG(int val, int reg, int pwm)
{
int ret;
- int range = val - AUTO_TEMP_MIN_FROM_REG(reg);
+ int range = ((val - AUTO_TEMP_MIN_FROM_REG(reg)) * 10) / (16 - pwm);
- range = ((val - AUTO_TEMP_MIN_FROM_REG(reg))*10)/(16 - pwm);
ret = ((reg & 0xf8) |
(range < 10000 ? 0 :
range < 20000 ? 1 :
--
2.33.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] hwmon: (adm1031): Remove redundant assignment to variable range
2021-12-04 23:31 [PATCH] hwmon: (adm1031): Remove redundant assignment to variable range Colin Ian King
@ 2021-12-07 17:30 ` Guenter Roeck
0 siblings, 0 replies; 2+ messages in thread
From: Guenter Roeck @ 2021-12-07 17:30 UTC (permalink / raw)
To: Colin Ian King; +Cc: Jean Delvare, linux-hwmon, kernel-janitors, linux-kernel
On Sat, Dec 04, 2021 at 11:31:55PM +0000, Colin Ian King wrote:
> Variable range is being initialized with a value that is never read, it
> is being re-assigned in the next statement. The assignment is redundant,
> remove it and initialize range using the second assigned value. Clean up
> the formatting too by adding missing spaces.
>
> Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
Applied.
Thanks,
Guenter
> ---
> drivers/hwmon/adm1031.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/hwmon/adm1031.c b/drivers/hwmon/adm1031.c
> index 257ec53ae723..ac841fa3a369 100644
> --- a/drivers/hwmon/adm1031.c
> +++ b/drivers/hwmon/adm1031.c
> @@ -242,9 +242,8 @@ static int FAN_TO_REG(int reg, int div)
> static int AUTO_TEMP_MAX_TO_REG(int val, int reg, int pwm)
> {
> int ret;
> - int range = val - AUTO_TEMP_MIN_FROM_REG(reg);
> + int range = ((val - AUTO_TEMP_MIN_FROM_REG(reg)) * 10) / (16 - pwm);
>
> - range = ((val - AUTO_TEMP_MIN_FROM_REG(reg))*10)/(16 - pwm);
> ret = ((reg & 0xf8) |
> (range < 10000 ? 0 :
> range < 20000 ? 1 :
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-12-07 17:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-04 23:31 [PATCH] hwmon: (adm1031): Remove redundant assignment to variable range Colin Ian King
2021-12-07 17:30 ` Guenter Roeck
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).