2004-03-04 06:34:51

by Kevin O'Connor

[permalink] [raw]
Subject: i2c_use_client broken

Hi Greg,

In 2.6.3's i2c-core.c there is the following code:

static int i2c_inc_use_client(struct i2c_client *client)
{

if (!try_module_get(client->driver->owner))
return -ENODEV;
if (!try_module_get(client->adapter->owner)) {
module_put(client->driver->owner);
return -ENODEV;
}

return 0;
}
[...]
int i2c_use_client(struct i2c_client *client)
{
if (!i2c_inc_use_client(client))
return -ENODEV;
[...]

The i2c_inc_use_client test looks backward - the code should look like:

if (i2c_inc_use_client(client))
return -ENODEV;

because i2c_inc_use_client returns 0 on success.

If I've missed something, please let me know. I apologize if you're not
the right person to mail or if this has already been fixed.

-Kevin

--
---------------------------------------------------------------------
| Kevin O'Connor "BTW, IMHO we need a FAQ for |
| [email protected] 'IMHO', 'FAQ', 'BTW', etc. !" |
---------------------------------------------------------------------


2004-03-09 23:31:27

by Greg KH

[permalink] [raw]
Subject: Re: i2c_use_client broken

On Thu, Mar 04, 2004 at 01:34:46AM -0500, Kevin O'Connor wrote:
> The i2c_inc_use_client test looks backward - the code should look like:
>
> if (i2c_inc_use_client(client))
> return -ENODEV;

Russell King just sent me a patch to fix this.

thanks,

greg k-h