diff options
-rw-r--r-- | drivers/mfd/mfd-core.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/drivers/mfd/mfd-core.c b/drivers/mfd/mfd-core.c index 8736f4539bc0..968775da638a 100644 --- a/drivers/mfd/mfd-core.c +++ b/drivers/mfd/mfd-core.c | |||
@@ -187,7 +187,7 @@ int mfd_add_devices(struct device *parent, int id, | |||
187 | int irq_base, struct irq_domain *domain) | 187 | int irq_base, struct irq_domain *domain) |
188 | { | 188 | { |
189 | int i; | 189 | int i; |
190 | int ret = 0; | 190 | int ret; |
191 | atomic_t *cnts; | 191 | atomic_t *cnts; |
192 | 192 | ||
193 | /* initialize reference counting for all cells */ | 193 | /* initialize reference counting for all cells */ |
@@ -200,12 +200,16 @@ int mfd_add_devices(struct device *parent, int id, | |||
200 | ret = mfd_add_device(parent, id, cells + i, cnts + i, mem_base, | 200 | ret = mfd_add_device(parent, id, cells + i, cnts + i, mem_base, |
201 | irq_base, domain); | 201 | irq_base, domain); |
202 | if (ret) | 202 | if (ret) |
203 | break; | 203 | goto fail; |
204 | } | 204 | } |
205 | 205 | ||
206 | if (ret) | 206 | return 0; |
207 | mfd_remove_devices(parent); | ||
208 | 207 | ||
208 | fail: | ||
209 | if (i) | ||
210 | mfd_remove_devices(parent); | ||
211 | else | ||
212 | kfree(cnts); | ||
209 | return ret; | 213 | return ret; |
210 | } | 214 | } |
211 | EXPORT_SYMBOL(mfd_add_devices); | 215 | EXPORT_SYMBOL(mfd_add_devices); |