From: Hans Verkuil Date: Wed, 12 Mar 2008 13:15:00 +0000 (+0100) Subject: i2c: Keep client->driver and client->dev.driver in sync X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=50c3304a5e1e5217fc6b58fb686edc7d1114f2fa;p=GitHub%2FLineageOS%2Fandroid_kernel_samsung_universal7580.git 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 Acked-by: David Brownell Signed-off-by: Jean Delvare --- diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c index 96da22e9a5a..fd84b2a3633 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)