diff options
author | Axel Lin <axel.lin@gmail.com> | 2012-06-07 20:35:37 -0400 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2012-07-08 18:16:11 -0400 |
commit | ff2b7ac6f6c58b0011d9d73004fb6e396f514018 (patch) | |
tree | 303de9ac1aad6192f1af84a460de39a98500cf3d /drivers/mfd/max77693.c | |
parent | 8b7353d17542b2a513aa62a9856215e99ddb8403 (diff) |
mfd: Fix max77693 irq leak and wrong kfree call
We need to call max77693_irq_exit() in max77693_i2c_probe error patch and
max77693_i2c_remove.
Current code already uses devm_kzalloc() to allocate memory for max77693.
Thus we should not call kfree(max77693), otherwise we got double free.
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers/mfd/max77693.c')
-rw-r--r-- | drivers/mfd/max77693.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/mfd/max77693.c b/drivers/mfd/max77693.c index 8eed0c47ade6..a1811cb50ec7 100644 --- a/drivers/mfd/max77693.c +++ b/drivers/mfd/max77693.c | |||
@@ -154,7 +154,7 @@ static int max77693_i2c_probe(struct i2c_client *i2c, | |||
154 | 154 | ||
155 | ret = max77693_irq_init(max77693); | 155 | ret = max77693_irq_init(max77693); |
156 | if (ret < 0) | 156 | if (ret < 0) |
157 | goto err_mfd; | 157 | goto err_irq; |
158 | 158 | ||
159 | pm_runtime_set_active(max77693->dev); | 159 | pm_runtime_set_active(max77693->dev); |
160 | 160 | ||
@@ -168,11 +168,11 @@ static int max77693_i2c_probe(struct i2c_client *i2c, | |||
168 | return ret; | 168 | return ret; |
169 | 169 | ||
170 | err_mfd: | 170 | err_mfd: |
171 | max77693_irq_exit(max77693); | ||
172 | err_irq: | ||
171 | i2c_unregister_device(max77693->muic); | 173 | i2c_unregister_device(max77693->muic); |
172 | i2c_unregister_device(max77693->haptic); | 174 | i2c_unregister_device(max77693->haptic); |
173 | err_regmap: | 175 | err_regmap: |
174 | kfree(max77693); | ||
175 | |||
176 | return ret; | 176 | return ret; |
177 | } | 177 | } |
178 | 178 | ||
@@ -181,6 +181,7 @@ static int max77693_i2c_remove(struct i2c_client *i2c) | |||
181 | struct max77693_dev *max77693 = i2c_get_clientdata(i2c); | 181 | struct max77693_dev *max77693 = i2c_get_clientdata(i2c); |
182 | 182 | ||
183 | mfd_remove_devices(max77693->dev); | 183 | mfd_remove_devices(max77693->dev); |
184 | max77693_irq_exit(max77693); | ||
184 | i2c_unregister_device(max77693->muic); | 185 | i2c_unregister_device(max77693->muic); |
185 | i2c_unregister_device(max77693->haptic); | 186 | i2c_unregister_device(max77693->haptic); |
186 | 187 | ||