aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/macintosh/windfarm_max6690_sensor.c
diff options
context:
space:
mode:
authorJean Delvare <khali@linux-fr.org>2009-10-04 16:53:46 -0400
committerJean Delvare <khali@linux-fr.org>2009-10-04 16:53:46 -0400
commit6f6b35e133fe4313277b30fc1a7ea313875ea6c9 (patch)
tree1b7aa0dde7d69b0f90b80a0398c9699faae6260e /drivers/macintosh/windfarm_max6690_sensor.c
parent18669eabde2ff5fc446e72e043f0539059763438 (diff)
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>
Diffstat (limited to 'drivers/macintosh/windfarm_max6690_sensor.c')
-rw-r--r--drivers/macintosh/windfarm_max6690_sensor.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/macintosh/windfarm_max6690_sensor.c b/drivers/macintosh/windfarm_max6690_sensor.c
index e2a55ecda2b2..a67b349319e9 100644
--- a/drivers/macintosh/windfarm_max6690_sensor.c
+++ b/drivers/macintosh/windfarm_max6690_sensor.c
@@ -88,6 +88,8 @@ static int wf_max6690_probe(struct i2c_client *client,
88 return rc; 88 return rc;
89} 89}
90 90
91static struct i2c_driver wf_max6690_driver;
92
91static struct i2c_client *wf_max6690_create(struct i2c_adapter *adapter, 93static struct i2c_client *wf_max6690_create(struct i2c_adapter *adapter,
92 u8 addr, const char *loc) 94 u8 addr, const char *loc)
93{ 95{
@@ -119,7 +121,7 @@ static struct i2c_client *wf_max6690_create(struct i2c_adapter *adapter,
119 * Let i2c-core delete that device on driver removal. 121 * Let i2c-core delete that device on driver removal.
120 * This is safe because i2c-core holds the core_lock mutex for us. 122 * This is safe because i2c-core holds the core_lock mutex for us.
121 */ 123 */
122 list_add_tail(&client->detected, &client->driver->clients); 124 list_add_tail(&client->detected, &wf_max6690_driver.clients);
123 return client; 125 return client;
124 126
125 fail: 127 fail: