aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/macintosh/windfarm_smu_sat.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_smu_sat.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_smu_sat.c')
-rw-r--r--drivers/macintosh/windfarm_smu_sat.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/macintosh/windfarm_smu_sat.c b/drivers/macintosh/windfarm_smu_sat.c
index 5da729e58f99..e20330a28959 100644
--- a/drivers/macintosh/windfarm_smu_sat.c
+++ b/drivers/macintosh/windfarm_smu_sat.c
@@ -194,6 +194,8 @@ static struct wf_sensor_ops wf_sat_ops = {
194 .owner = THIS_MODULE, 194 .owner = THIS_MODULE,
195}; 195};
196 196
197static struct i2c_driver wf_sat_driver;
198
197static void wf_sat_create(struct i2c_adapter *adapter, struct device_node *dev) 199static void wf_sat_create(struct i2c_adapter *adapter, struct device_node *dev)
198{ 200{
199 struct i2c_board_info info; 201 struct i2c_board_info info;
@@ -222,7 +224,7 @@ static void wf_sat_create(struct i2c_adapter *adapter, struct device_node *dev)
222 * Let i2c-core delete that device on driver removal. 224 * Let i2c-core delete that device on driver removal.
223 * This is safe because i2c-core holds the core_lock mutex for us. 225 * This is safe because i2c-core holds the core_lock mutex for us.
224 */ 226 */
225 list_add_tail(&client->detected, &client->driver->clients); 227 list_add_tail(&client->detected, &wf_sat_driver.clients);
226} 228}
227 229
228static int wf_sat_probe(struct i2c_client *client, 230static int wf_sat_probe(struct i2c_client *client,