Skip to contentSkip to conversation

I2C chip drivers return -EINVAL on error

PATCH New Jean Delvare 1 participant 1 message May 19, 2005

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 I2C chip drivers return -EINVAL on error

Quoted 7 lines
Quoted 2 lines

Well make it a real error, like -EINVAL or something, so userspace has a chance to report it properly. Not just -1.

Oh, I guess we want to correct it87.c and fscher.c in that way too then.

I had this to my todo list.

(I meant: I *add* this...)

OK, here is the patch. Should apply cleanly on top of all the other patches I sent you today (kmalloc, error paths, w83781d pwm).

Thanks.

drivers/i2c/chips/fscher.c renamed from drivers/i2c/chips/fscher.c.orig +1 -1
@@ -512,7 +512,7 @@
 	default:
 		dev_err(&client->dev, "fan_div value %ld not "
 			 "supported. Choose one of 2, 4 or 8!\n", v);
-		return -1;
+		return -EINVAL;
 	}
 
 	/* bits 2..7 reserved => mask with 0x03 */
drivers/i2c/chips/it87.c renamed from drivers/i2c/chips/it87.c.orig +1 -1
@@ -367,7 +367,7 @@
 	else if (val = 2)
 	    data->sensor |= 8 << nr;
 	else if (val != 0)
-		return -1;
+		return -EINVAL;
 	it87_write_value(client, IT87_REG_TEMP_ENABLE, data->sensor);
 	return count;
 }
drivers/i2c/chips/pcf8591.c renamed from drivers/i2c/chips/pcf8591.c.orig +2 -1
@@ -130,8 +130,9 @@
 	{
 		data->aout = value;
 		i2c_smbus_write_byte_data(client, data->control, data->aout);
+		return count;
 	}
-	return count;
+	return -EINVAL;
 }
 
 static DEVICE_ATTR(out0_output, S_IWUSR | S_IRUGO, 
Signature · 2 lines
Jean Delvare
http://www.ensicaen.ismra.fr/~delvare/