diff options
author | Wolfram Sang <w.sang@pengutronix.de> | 2010-03-20 10:12:54 -0400 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2010-05-27 19:37:28 -0400 |
commit | f322d5f0097333343bfd92b47258ee997c889263 (patch) | |
tree | d6f0d4b0e0f6e6a8fa778a73c740916ca5616dd2 /drivers/mfd/menelaus.c | |
parent | d84027bc4d176a0c06e8f62a9f7a002bdd444012 (diff) |
mfd: 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>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers/mfd/menelaus.c')
-rw-r--r-- | drivers/mfd/menelaus.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/mfd/menelaus.c b/drivers/mfd/menelaus.c index a94b131a18ef..721948be12c7 100644 --- a/drivers/mfd/menelaus.c +++ b/drivers/mfd/menelaus.c | |||
@@ -1228,6 +1228,7 @@ fail2: | |||
1228 | free_irq(client->irq, menelaus); | 1228 | free_irq(client->irq, menelaus); |
1229 | flush_scheduled_work(); | 1229 | flush_scheduled_work(); |
1230 | fail1: | 1230 | fail1: |
1231 | i2c_set_clientdata(client, NULL); | ||
1231 | kfree(menelaus); | 1232 | kfree(menelaus); |
1232 | return err; | 1233 | return err; |
1233 | } | 1234 | } |
@@ -1237,8 +1238,8 @@ static int __exit menelaus_remove(struct i2c_client *client) | |||
1237 | struct menelaus_chip *menelaus = i2c_get_clientdata(client); | 1238 | struct menelaus_chip *menelaus = i2c_get_clientdata(client); |
1238 | 1239 | ||
1239 | free_irq(client->irq, menelaus); | 1240 | free_irq(client->irq, menelaus); |
1240 | kfree(menelaus); | ||
1241 | i2c_set_clientdata(client, NULL); | 1241 | i2c_set_clientdata(client, NULL); |
1242 | kfree(menelaus); | ||
1242 | the_menelaus = NULL; | 1243 | the_menelaus = NULL; |
1243 | return 0; | 1244 | return 0; |
1244 | } | 1245 | } |