macintosh: Don't assume i2c device probing always succeeds

If i2c device probing fails, then there is no driver to dereference
after calling i2c_new_device(). Stop assuming that probing will always
succeed, to avoid NULL pointer dereferences. We have an easier access
to the driver anyway.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Tested-by: Tim Shepard <shep@alum.mit.edu>
Cc: Colin Leroy <colin@colino.net>
This commit is contained in:
Jean Delvare
2009-10-04 22:53:46 +02:00
父節點 18669eabde
當前提交 6f6b35e133
共有 5 個文件被更改,包括 15 次插入5 次删除

查看文件

@@ -88,6 +88,8 @@ static int wf_max6690_probe(struct i2c_client *client,
return rc;
}
static struct i2c_driver wf_max6690_driver;
static struct i2c_client *wf_max6690_create(struct i2c_adapter *adapter,
u8 addr, const char *loc)
{
@@ -119,7 +121,7 @@ static struct i2c_client *wf_max6690_create(struct i2c_adapter *adapter,
* Let i2c-core delete that device on driver removal.
* This is safe because i2c-core holds the core_lock mutex for us.
*/
list_add_tail(&client->detected, &client->driver->clients);
list_add_tail(&client->detected, &wf_max6690_driver.clients);
return client;
fail: