[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20211204233155.55454-1-colin.i.king@gmail.com>
Date: Sat, 4 Dec 2021 23:31:55 +0000
From: Colin Ian King <colin.i.king@...il.com>
To: Jean Delvare <jdelvare@...e.com>,
Guenter Roeck <linux@...ck-us.net>, linux-hwmon@...r.kernel.org
Cc: kernel-janitors@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH] hwmon: (adm1031): Remove redundant assignment to variable range
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@...il.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
Powered by blists - more mailing lists