diff options
author | Wolfram Sang <w.sang@pengutronix.de> | 2010-03-20 10:12:58 -0400 |
---|---|---|
committer | Liam Girdwood <lrg@slimlogic.co.uk> | 2010-03-22 15:46:16 -0400 |
commit | 8b4709ecea4aab1957ae7b726d6824485404a3a5 (patch) | |
tree | a06347a92952b086cb48e8186682daf4f9884548 /drivers/regulator | |
parent | 451a73cd46573444f68f412c87439c0a291718ec (diff) |
regulator: fix dangling pointers
Fix I2C-drivers which missed setting clientdata to NULL before freeing the
structure it points to. Also fix drivers which do this _after_ the structure
was freed already.
Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Cc: Liam Girdwood <lrg@slimlogic.co.uk>
Cc: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
Diffstat (limited to 'drivers/regulator')
-rw-r--r-- | drivers/regulator/max1586.c | 2 | ||||
-rw-r--r-- | drivers/regulator/max8649.c | 3 | ||||
-rw-r--r-- | drivers/regulator/max8660.c | 2 |
3 files changed, 4 insertions, 3 deletions
diff --git a/drivers/regulator/max1586.c b/drivers/regulator/max1586.c index a49fc952c9a9..c0b09e15edb6 100644 --- a/drivers/regulator/max1586.c +++ b/drivers/regulator/max1586.c | |||
@@ -243,8 +243,8 @@ static int __devexit max1586_pmic_remove(struct i2c_client *client) | |||
243 | for (i = 0; i <= MAX1586_V6; i++) | 243 | for (i = 0; i <= MAX1586_V6; i++) |
244 | if (rdev[i]) | 244 | if (rdev[i]) |
245 | regulator_unregister(rdev[i]); | 245 | regulator_unregister(rdev[i]); |
246 | kfree(rdev); | ||
247 | i2c_set_clientdata(client, NULL); | 246 | i2c_set_clientdata(client, NULL); |
247 | kfree(rdev); | ||
248 | 248 | ||
249 | return 0; | 249 | return 0; |
250 | } | 250 | } |
diff --git a/drivers/regulator/max8649.c b/drivers/regulator/max8649.c index 3ebdf698c648..833aaedc7e64 100644 --- a/drivers/regulator/max8649.c +++ b/drivers/regulator/max8649.c | |||
@@ -356,6 +356,7 @@ static int __devinit max8649_regulator_probe(struct i2c_client *client, | |||
356 | dev_info(info->dev, "Max8649 regulator device is detected.\n"); | 356 | dev_info(info->dev, "Max8649 regulator device is detected.\n"); |
357 | return 0; | 357 | return 0; |
358 | out: | 358 | out: |
359 | i2c_set_clientdata(client, NULL); | ||
359 | kfree(info); | 360 | kfree(info); |
360 | return ret; | 361 | return ret; |
361 | } | 362 | } |
@@ -367,9 +368,9 @@ static int __devexit max8649_regulator_remove(struct i2c_client *client) | |||
367 | if (info) { | 368 | if (info) { |
368 | if (info->regulator) | 369 | if (info->regulator) |
369 | regulator_unregister(info->regulator); | 370 | regulator_unregister(info->regulator); |
371 | i2c_set_clientdata(client, NULL); | ||
370 | kfree(info); | 372 | kfree(info); |
371 | } | 373 | } |
372 | i2c_set_clientdata(client, NULL); | ||
373 | 374 | ||
374 | return 0; | 375 | return 0; |
375 | } | 376 | } |
diff --git a/drivers/regulator/max8660.c b/drivers/regulator/max8660.c index f12f1bb62138..47f90b2fc290 100644 --- a/drivers/regulator/max8660.c +++ b/drivers/regulator/max8660.c | |||
@@ -470,8 +470,8 @@ static int __devexit max8660_remove(struct i2c_client *client) | |||
470 | for (i = 0; i < MAX8660_V_END; i++) | 470 | for (i = 0; i < MAX8660_V_END; i++) |
471 | if (rdev[i]) | 471 | if (rdev[i]) |
472 | regulator_unregister(rdev[i]); | 472 | regulator_unregister(rdev[i]); |
473 | kfree(rdev); | ||
474 | i2c_set_clientdata(client, NULL); | 473 | i2c_set_clientdata(client, NULL); |
474 | kfree(rdev); | ||
475 | 475 | ||
476 | return 0; | 476 | return 0; |
477 | } | 477 | } |