mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] hwmon: HS3001: remove redundant store on division
@ 2023-10-23 13:58 Colin Ian King
  2023-10-25 19:00 ` Guenter Roeck
  0 siblings, 1 reply; 2+ messages in thread
From: Colin Ian King @ 2023-10-23 13:58 UTC (permalink / raw)
  To: Andre Werner, Jean Delvare, Guenter Roeck, linux-hwmon
  Cc: kernel-janitors, linux-kernel

Currently the local variable hum is being divided by a constant and
the results is being re-assigned back to hum before the value is being
returned to the caller. The assignment to hum is redundant and can
be removed.

Cleans up clang scan build warning:
drivers/hwmon/hs3001.c:65:9: warning: Although the value stored to 'hum'
is used in the enclosing expression, the value is never actually read
from 'hum' [deadcode.DeadStores]

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
---
 drivers/hwmon/hs3001.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/hwmon/hs3001.c b/drivers/hwmon/hs3001.c
index ac574e46d069..01ea9a3062bc 100644
--- a/drivers/hwmon/hs3001.c
+++ b/drivers/hwmon/hs3001.c
@@ -62,7 +62,7 @@ static u32 hs3001_extract_humidity(u16 raw)
 {
 	u32 hum = (raw & HS3001_MASK_HUMIDITY_0X3FFF) * HS3001_FIXPOINT_ARITH * 100;
 
-	return hum /= (1 << 14) - 1;
+	return hum / (1 << 14) - 1;
 }
 
 static int hs3001_data_fetch_command(struct i2c_client *client,
-- 
2.39.2


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] hwmon: HS3001: remove redundant store on division
  2023-10-23 13:58 [PATCH] hwmon: HS3001: remove redundant store on division Colin Ian King
@ 2023-10-25 19:00 ` Guenter Roeck
  0 siblings, 0 replies; 2+ messages in thread
From: Guenter Roeck @ 2023-10-25 19:00 UTC (permalink / raw)
  To: Colin Ian King
  Cc: Andre Werner, Jean Delvare, linux-hwmon, kernel-janitors, linux-kernel

On Mon, Oct 23, 2023 at 02:58:28PM +0100, Colin Ian King wrote:
> Currently the local variable hum is being divided by a constant and
> the results is being re-assigned back to hum before the value is being
> returned to the caller. The assignment to hum is redundant and can
> be removed.
> 
> Cleans up clang scan build warning:
> drivers/hwmon/hs3001.c:65:9: warning: Although the value stored to 'hum'
> is used in the enclosing expression, the value is never actually read
> from 'hum' [deadcode.DeadStores]
> 
> Signed-off-by: Colin Ian King <colin.i.king@gmail.com>

Applied.

Guenter

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-10-25 19:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-23 13:58 [PATCH] hwmon: HS3001: remove redundant store on division Colin Ian King
2023-10-25 19:00 ` Guenter Roeck

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®