linux-hwmon.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] hwmon: nct7904: fix comparison of u8 variable ret with less than zero
@ 2019-06-06 12:38 Colin King
  0 siblings, 0 replies; only message in thread
From: Colin King @ 2019-06-06 12:38 UTC (permalink / raw)
  To: amy . shih, Jean Delvare, Guenter Roeck, linux-hwmon
  Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

Currently u8 variable tmp is being checked for negative error returns
however this will be false since tmp is unsigned. Fix this by making
tmp an int.

Addresses-Coverity: ("Unsigned compared against 0")
Fixes: af55ab0b0792 ("hwmon: (nct7904) Add extra sysfs support for fan, voltage and temperature.")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/hwmon/nct7904.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/hwmon/nct7904.c b/drivers/hwmon/nct7904.c
index 5fa69898674c..b63f51d0378e 100644
--- a/drivers/hwmon/nct7904.c
+++ b/drivers/hwmon/nct7904.c
@@ -567,8 +567,7 @@ static int nct7904_write_in(struct device *dev, u32 attr, int channel,
 			    long val)
 {
 	struct nct7904_data *data = dev_get_drvdata(dev);
-	int ret, index;
-	u8 tmp;
+	int ret, index, tmp;
 
 	index = nct7904_chan_to_index[channel];
 
-- 
2.20.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2019-06-06 12:39 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-06 12:38 [PATCH] hwmon: nct7904: fix comparison of u8 variable ret with less than zero Colin King

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).