提交 50c3304a 编写于 作者: H Hans Verkuil 提交者: Jean Delvare

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: NHans Verkuil <hverkuil@xs4all.nl>
Acked-by: NDavid Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: NJean Delvare <khali@linux-fr.org>
上级 5edc68b8
......@@ -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)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册