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 | |
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')
-rw-r--r-- | drivers/mfd/88pm860x-i2c.c | 1 | ||||
-rw-r--r-- | drivers/mfd/ab3100-core.c | 2 | ||||
-rw-r--r-- | drivers/mfd/da903x.c | 1 | ||||
-rw-r--r-- | drivers/mfd/menelaus.c | 3 | ||||
-rw-r--r-- | drivers/mfd/pcf50633-core.c | 1 | ||||
-rw-r--r-- | drivers/mfd/tps65010.c | 2 | ||||
-rw-r--r-- | drivers/mfd/wm8350-i2c.c | 2 |
7 files changed, 10 insertions, 2 deletions
diff --git a/drivers/mfd/88pm860x-i2c.c b/drivers/mfd/88pm860x-i2c.c index 4a6e7186334e..b0bade1881d4 100644 --- a/drivers/mfd/88pm860x-i2c.c +++ b/drivers/mfd/88pm860x-i2c.c | |||
@@ -202,6 +202,7 @@ static int __devexit pm860x_remove(struct i2c_client *client) | |||
202 | i2c_unregister_device(chip->companion); | 202 | i2c_unregister_device(chip->companion); |
203 | i2c_set_clientdata(chip->companion, NULL); | 203 | i2c_set_clientdata(chip->companion, NULL); |
204 | i2c_set_clientdata(chip->client, NULL); | 204 | i2c_set_clientdata(chip->client, NULL); |
205 | i2c_set_clientdata(client, NULL); | ||
205 | kfree(chip); | 206 | kfree(chip); |
206 | return 0; | 207 | return 0; |
207 | } | 208 | } |
diff --git a/drivers/mfd/ab3100-core.c b/drivers/mfd/ab3100-core.c index e4ca5909e424..16898211cd1a 100644 --- a/drivers/mfd/ab3100-core.c +++ b/drivers/mfd/ab3100-core.c | |||
@@ -920,6 +920,7 @@ static int __init ab3100_probe(struct i2c_client *client, | |||
920 | i2c_unregister_device(ab3100->testreg_client); | 920 | i2c_unregister_device(ab3100->testreg_client); |
921 | exit_no_testreg_client: | 921 | exit_no_testreg_client: |
922 | exit_no_detect: | 922 | exit_no_detect: |
923 | i2c_set_clientdata(client, NULL); | ||
923 | kfree(ab3100); | 924 | kfree(ab3100); |
924 | return err; | 925 | return err; |
925 | } | 926 | } |
@@ -941,6 +942,7 @@ static int __exit ab3100_remove(struct i2c_client *client) | |||
941 | * their notifiers so deactivate IRQ | 942 | * their notifiers so deactivate IRQ |
942 | */ | 943 | */ |
943 | free_irq(client->irq, ab3100); | 944 | free_irq(client->irq, ab3100); |
945 | i2c_set_clientdata(client, NULL); | ||
944 | kfree(ab3100); | 946 | kfree(ab3100); |
945 | return 0; | 947 | return 0; |
946 | } | 948 | } |
diff --git a/drivers/mfd/da903x.c b/drivers/mfd/da903x.c index 67181b147ab3..3ad915d0589c 100644 --- a/drivers/mfd/da903x.c +++ b/drivers/mfd/da903x.c | |||
@@ -544,6 +544,7 @@ static int __devexit da903x_remove(struct i2c_client *client) | |||
544 | struct da903x_chip *chip = i2c_get_clientdata(client); | 544 | struct da903x_chip *chip = i2c_get_clientdata(client); |
545 | 545 | ||
546 | da903x_remove_subdevs(chip); | 546 | da903x_remove_subdevs(chip); |
547 | i2c_set_clientdata(client, NULL); | ||
547 | kfree(chip); | 548 | kfree(chip); |
548 | return 0; | 549 | return 0; |
549 | } | 550 | } |
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 | } |
diff --git a/drivers/mfd/pcf50633-core.c b/drivers/mfd/pcf50633-core.c index dc95ddb708f1..710e417e0eec 100644 --- a/drivers/mfd/pcf50633-core.c +++ b/drivers/mfd/pcf50633-core.c | |||
@@ -679,6 +679,7 @@ static int __devexit pcf50633_remove(struct i2c_client *client) | |||
679 | for (i = 0; i < PCF50633_NUM_REGULATORS; i++) | 679 | for (i = 0; i < PCF50633_NUM_REGULATORS; i++) |
680 | platform_device_unregister(pcf->regulator_pdev[i]); | 680 | platform_device_unregister(pcf->regulator_pdev[i]); |
681 | 681 | ||
682 | i2c_set_clientdata(client, NULL); | ||
682 | kfree(pcf); | 683 | kfree(pcf); |
683 | 684 | ||
684 | return 0; | 685 | return 0; |
diff --git a/drivers/mfd/tps65010.c b/drivers/mfd/tps65010.c index e5955306c2fa..9b22a77f70f5 100644 --- a/drivers/mfd/tps65010.c +++ b/drivers/mfd/tps65010.c | |||
@@ -530,8 +530,8 @@ static int __exit tps65010_remove(struct i2c_client *client) | |||
530 | cancel_delayed_work(&tps->work); | 530 | cancel_delayed_work(&tps->work); |
531 | flush_scheduled_work(); | 531 | flush_scheduled_work(); |
532 | debugfs_remove(tps->file); | 532 | debugfs_remove(tps->file); |
533 | kfree(tps); | ||
534 | i2c_set_clientdata(client, NULL); | 533 | i2c_set_clientdata(client, NULL); |
534 | kfree(tps); | ||
535 | the_tps = NULL; | 535 | the_tps = NULL; |
536 | return 0; | 536 | return 0; |
537 | } | 537 | } |
diff --git a/drivers/mfd/wm8350-i2c.c b/drivers/mfd/wm8350-i2c.c index 65830f57c093..aa3ba0974ee5 100644 --- a/drivers/mfd/wm8350-i2c.c +++ b/drivers/mfd/wm8350-i2c.c | |||
@@ -82,6 +82,7 @@ static int wm8350_i2c_probe(struct i2c_client *i2c, | |||
82 | return ret; | 82 | return ret; |
83 | 83 | ||
84 | err: | 84 | err: |
85 | i2c_set_clientdata(i2c, NULL); | ||
85 | kfree(wm8350); | 86 | kfree(wm8350); |
86 | return ret; | 87 | return ret; |
87 | } | 88 | } |
@@ -91,6 +92,7 @@ static int wm8350_i2c_remove(struct i2c_client *i2c) | |||
91 | struct wm8350 *wm8350 = i2c_get_clientdata(i2c); | 92 | struct wm8350 *wm8350 = i2c_get_clientdata(i2c); |
92 | 93 | ||
93 | wm8350_device_exit(wm8350); | 94 | wm8350_device_exit(wm8350); |
95 | i2c_set_clientdata(i2c, NULL); | ||
94 | kfree(wm8350); | 96 | kfree(wm8350); |
95 | 97 | ||
96 | return 0; | 98 | return 0; |