[PATCH] Fix i2c_use_client()

From: Russell King
Date: Sun Mar 07 2004 - 11:15:35 EST


i2c_use_client() contains a bogosity. If i2c_inc_use_client() returns
success, i2c_use_client() returns an error. If i2c_inc_use_client()
fails, i2c_use_client() might succeed.

Fix it so that (a) we get the correct sense between these two functions,
and (b) propagate the error code from i2c_inc_use_client(), rather than
making our own one up.

--- orig/drivers/i2c/i2c-core.c Wed Feb 18 22:33:49 2004
+++ linux/drivers/i2c/i2c-core.c Sun Mar 7 16:05:27 2004
@@ -437,8 +437,11 @@ static void i2c_dec_use_client(struct i2

int i2c_use_client(struct i2c_client *client)
{
- if (!i2c_inc_use_client(client))
- return -ENODEV;
+ int ret;
+
+ ret = i2c_inc_use_client(client);
+ if (ret)
+ return ret;

if (client->flags & I2C_CLIENT_ALLOW_USE) {
if (client->flags & I2C_CLIENT_ALLOW_MULTIPLE_USE)

--
Russell King
Linux kernel 2.6 ARM Linux - http://www.arm.linux.org.uk/
maintainer of: 2.6 PCMCIA - http://pcmcia.arm.linux.org.uk/
2.6 Serial core
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/