* [PATCH] Fix i2c_use_client()
@ 2004-03-07 16:13 Russell King
2004-03-09 23:02 ` Greg KH
0 siblings, 1 reply; 2+ messages in thread
From: Russell King @ 2004-03-07 16:13 UTC (permalink / raw)
To: Linux Kernel List, Greg KH
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] Fix i2c_use_client()
2004-03-07 16:13 [PATCH] Fix i2c_use_client() Russell King
@ 2004-03-09 23:02 ` Greg KH
0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2004-03-09 23:02 UTC (permalink / raw)
To: Linux Kernel List
On Sun, Mar 07, 2004 at 04:13:41PM +0000, Russell King wrote:
> 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.
Nice, thanks. I've applied this.
greg k-h
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2004-03-09 23:33 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-03-07 16:13 [PATCH] Fix i2c_use_client() Russell King
2004-03-09 23:02 ` Greg KH
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®