summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil@xs4all.nl>2008-03-12 14:15:00 +0100
committerJean Delvare <khali@hyperion.delvare>2008-03-12 14:15:00 +0100
commit50c3304a5e1e5217fc6b58fb686edc7d1114f2fa (patch)
treeb61f31a58fc39f965ff21e0f03315c36c9bd122b /drivers
parenti2c-amd756: Fix off-by-one (diff)
downloadlinux-50c3304a5e1e5217fc6b58fb686edc7d1114f2fa.tar.xz
linux-50c3304a5e1e5217fc6b58fb686edc7d1114f2fa.zip
i2c: Keep client->driver and client->dev.driver in sync
Ensure that client->driver is set to NULL if the probe() returns an error (this keeps client->driver and client->dev.driver in sync). Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Acked-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Jean Delvare <khali@linux-fr.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/i2c/i2c-core.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
index 96da22e9a5a4..fd84b2a36338 100644
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
@@ -90,12 +90,16 @@ static int i2c_device_probe(struct device *dev)
{
struct i2c_client *client = to_i2c_client(dev);
struct i2c_driver *driver = to_i2c_driver(dev->driver);
+ int status;
if (!driver->probe)
return -ENODEV;
client->driver = driver;
dev_dbg(dev, "probe\n");
- return driver->probe(client);
+ status = driver->probe(client);
+ if (status)
+ client->driver = NULL;
+ return status;
}
static int i2c_device_remove(struct device *dev)