Fix i2c_use_client()
PATCH 1/1 Fix i2c_use_client()
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.
drivers/i2c/i2c-core.c +5 -2
@@ -437,8 +437,11 @@ static void i2c_dec_use_client(struct i2int 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 )
Signature · 4 lines
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 coreQuoted 7 lines · Russell King
i2c_use_client()contains a bogosity. Ifi2c_inc_use_client()returns success,i2c_use_client()returns an error. Ifi2c_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.
Nice, thanks. I've applied this.
greg k-h