aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/macintosh/therm_pm72.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/therm_pm72.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/therm_pm72.c')
-rw-r--r--drivers/macintosh/therm_pm72.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/macintosh/therm_pm72.c b/drivers/macintosh/therm_pm72.c
index a028598af2d3..ea32c7e5a9af 100644
--- a/drivers/macintosh/therm_pm72.c
+++ b/drivers/macintosh/therm_pm72.c
@@ -286,6 +286,8 @@ struct fcu_fan_table fcu_fans[] = {
286 }, 286 },
287}; 287};
288 288
289static struct i2c_driver therm_pm72_driver;
290
289/* 291/*
290 * Utility function to create an i2c_client structure and 292 * Utility function to create an i2c_client structure and
291 * attach it to one of u3 adapters 293 * attach it to one of u3 adapters
@@ -318,7 +320,7 @@ static struct i2c_client *attach_i2c_chip(int id, const char *name)
318 * Let i2c-core delete that device on driver removal. 320 * Let i2c-core delete that device on driver removal.
319 * This is safe because i2c-core holds the core_lock mutex for us. 321 * This is safe because i2c-core holds the core_lock mutex for us.
320 */ 322 */
321 list_add_tail(&clt->detected, &clt->driver->clients); 323 list_add_tail(&clt->detected, &therm_pm72_driver.clients);
322 return clt; 324 return clt;
323} 325}
324 326