Skip to contentSkip to conversation

corrset useage of negative number in an unsigned long

PATCH New Darren Jenkins\ 1 participant 1 message Feb 20, 2006

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 corrset useage of negative number in an unsigned long

G'day list,

from http://linuxicc.sourceforge.net/,

ICC complains about a "Pointless comparsion of unsigned interger with zero" @ line 760 & 808 of asus_acpi.c

In both cases this is due to stuffing an int returned from parse_arg into an unsigned long. However we need the negative cases so in the patch below I have just added an extra int i, to store and use the returned value.

drivers/acpi/asus_acpi.c renamed from drivers/acpi/asus_acpi.c.orig +8 -8
@@ -750,14 +750,14 @@ static int
 proc_write_brn(struct file *file, const char __user * buffer,
 	       unsigned long count, void *data)
 {
-	int value;
+	int value, i;
 
-	count = parse_arg(buffer, count, &value);
-	if (count > 0) {
+	i = parse_arg(buffer, count, &value);
+	if (i > 0) {
 		value = (0 < value) ? ((15 < value) ? 15 : value) : 0;
 		/* 0 <= value <= 15 */
 		set_brightness(value);
-	} else if (count < 0) {
+	} else if (i < 0) {
 		printk(KERN_WARNING "Asus ACPI: Error reading user input\n");
 	}
 
@@ -800,12 +800,12 @@ static int
 proc_write_disp(struct file *file, const char __user * buffer,
 		unsigned long count, void *data)
 {
-	int value;
+	int value,i;
 
-	count = parse_arg(buffer, count, &value);
-	if (count > 0)
+	i = parse_arg(buffer, count, &value);
+	if (i > 0)
 		set_display(value);
-	else if (count < 0)
+	else if (i < 0)
 		printk(KERN_WARNING "Asus ACPI: Error reading user input\n");
 
 	return count;

_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.osdl.org/mailman/listinfo/kernel-janitors