Skip to contentSkip to conversation

hwmon: jz4740: fix signedness bug

PATCH Applied Axel Lin 4 participants 6 messages Dec 8, 2011 – Jan 6, 2012 Hardware monitoring

lore
Share & tools
lore

Axel Lin

author
#0 lore raw

PATCH 1/2 hwmon: jz4740: fix signedness bug

wait_for_completion_interruptible_timeout() may return negative value. In this case, checking if (t > 0) will return true if t is unsigned.

---
 drivers/hwmon/jz4740-hwmon.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/hwmon/jz4740-hwmon.c +1 -1
index 7a48b1e..3d7e590 100644
@@ -59,7 +59,7 @@ static ssize_t jz4740_hwmon_read_adcin(struct device *dev,
 {
 	struct jz4740_hwmon *hwmon = dev_get_drvdata(dev);
 	struct completion *completion = &hwmon->read_completion;
-	unsigned long t;
+	long t;
 	unsigned long val;
 	int ret;
 
Signature · 9 lines
1.7.5.4




_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
author
#1 lore raw

PATCH 2/2 jz4740-battery: fix signedness bug

wait_for_completion_interruptible_timeout() may return negative value. In this case, checking if (t > 0) will return true if t is unsigned.

---
 drivers/power/jz4740-battery.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/power/jz4740-battery.c +1 -1
index 763f894..5bb1ddd 100644
@@ -67,7 +67,7 @@ static irqreturn_t jz_battery_irq_handler(int irq, void *devid)
 
 static long jz_battery_read_voltage(struct jz_battery *battery)
 {
-	unsigned long t;
+	long t;
 	unsigned long val;
 	long voltage;
 
Signature · 1 line
1.7.5.4
Acked-by on v1 2/2
#2 lore raw

Re: [PATCH 2/2] jz4740-battery: fix signedness bug

Quoted 4 lines · Axel Lin

wait_for_completion_interruptible_timeout() may return negative value. In this case, checking if (t > 0) will return true if t is unsigned.

Thanks

Quoted 17 lines
---
 drivers/power/jz4740-battery.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/power/jz4740-battery.c +1 -1
index 763f894..5bb1ddd 100644
@@ -67,7 +67,7 @@ static irqreturn_t jz_battery_irq_handler(int irq, void *devid)
 
 static long jz_battery_read_voltage(struct jz_battery *battery)
 {
-	unsigned long t;
+	long t;
 	unsigned long val;
 	long voltage;
 
Acked-by on v1 1/2
#4 lore raw
In reply to Axel Lin
Quoted 4 lines · Axel Lin

wait_for_completion_interruptible_timeout() may return negative value. In this case, checking if (t > 0) will return true if t is unsigned.

Thanks

Quoted 17 lines
---
 drivers/hwmon/jz4740-hwmon.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/hwmon/jz4740-hwmon.c +1 -1
index 7a48b1e..3d7e590 100644
@@ -59,7 +59,7 @@ static ssize_t jz4740_hwmon_read_adcin(struct device *dev,
 {
 	struct jz4740_hwmon *hwmon = dev_get_drvdata(dev);
 	struct completion *completion = &hwmon->read_completion;
-	unsigned long t;
+	long t;
 	unsigned long val;
 	int ret;