Skip to content

Commit

Permalink
i2c: Check for address business before creating clients
Browse files Browse the repository at this point in the history
We check for address business in i2c_probe_address(),
i2c_detect_address() and i2c_new_probed_device(), but this isn't
sufficient. Drivers can call i2c_attach_client() and
i2c_new_device() on any address, so we must check the address there
as well.

This fixes bug #11239:
http://bugzilla.kernel.org/show_bug.cgi?id=11239

Signed-off-by: Jean Delvare <khali@linux-fr.org>
  • Loading branch information
Jean Delvare authored and Jean Delvare committed Aug 10, 2008
1 parent 8d24f8d commit c1159f9
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion drivers/i2c/i2c-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -813,7 +813,12 @@ static int i2c_check_addr(struct i2c_adapter *adapter, int addr)
int i2c_attach_client(struct i2c_client *client)
{
struct i2c_adapter *adapter = client->adapter;
int res = 0;
int res;

/* Check for address business */
res = i2c_check_addr(adapter, client->addr);
if (res)
return res;

client->dev.parent = &client->adapter->dev;
client->dev.bus = &i2c_bus_type;
Expand Down

0 comments on commit c1159f9

Please sign in to comment.