diff options
author | Wolfram Sang <w.sang@pengutronix.de> | 2010-05-04 11:09:27 +0200 |
---|---|---|
committer | Jean Delvare <khali@linux-fr.org> | 2010-05-04 11:09:27 +0200 |
commit | e4a7b9b04de15f6b63da5ccdd373ffa3057a3681 (patch) | |
tree | 7f2f49df9dc66b334b85f83347df03d2b0d0a721 /drivers/i2c | |
parent | d93ac51c7a129db7a1431d859a3ef45a0b1f3fc5 (diff) |
i2c-core: Erase pointer to clientdata on removal
After discovering that a lot of i2c-drivers leave the pointer to their
clientdata dangling, it was decided to let the core handle this issue.
It is assumed that the core may access the private data after remove()
as there are no guarantees for the lifetime of such pointers anyhow (see
thread starting at http://lkml.org/lkml/2010/3/21/68)
Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Diffstat (limited to 'drivers/i2c')
-rw-r--r-- | drivers/i2c/i2c-core.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c index 3202a86f420e..b9306b1a6baa 100644 --- a/drivers/i2c/i2c-core.c +++ b/drivers/i2c/i2c-core.c @@ -117,8 +117,10 @@ static int i2c_device_probe(struct device *dev) dev_dbg(dev, "probe\n"); status = driver->probe(client, i2c_match_id(driver->id_table, client)); - if (status) + if (status) { client->driver = NULL; + i2c_set_clientdata(client, NULL); + } return status; } @@ -139,8 +141,10 @@ static int i2c_device_remove(struct device *dev) dev->driver = NULL; status = 0; } - if (status == 0) + if (status == 0) { client->driver = NULL; + i2c_set_clientdata(client, NULL); + } return status; } |