diff options
| -rw-r--r-- | drivers/mfd/wm8994-core.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/drivers/mfd/wm8994-core.c b/drivers/mfd/wm8994-core.c index 1e644aa53a2d..8588dbad3301 100644 --- a/drivers/mfd/wm8994-core.c +++ b/drivers/mfd/wm8994-core.c | |||
| @@ -393,8 +393,13 @@ static int wm8994_device_init(struct wm8994 *wm8994, int irq) | |||
| 393 | BUG(); | 393 | BUG(); |
| 394 | goto err; | 394 | goto err; |
| 395 | } | 395 | } |
| 396 | 396 | ||
| 397 | ret = devm_regulator_bulk_get(wm8994->dev, wm8994->num_supplies, | 397 | /* |
| 398 | * Can't use devres helper here as some of the supplies are provided by | ||
| 399 | * wm8994->dev's children (regulators) and those regulators are | ||
| 400 | * unregistered by the devres core before the supplies are freed. | ||
| 401 | */ | ||
| 402 | ret = regulator_bulk_get(wm8994->dev, wm8994->num_supplies, | ||
| 398 | wm8994->supplies); | 403 | wm8994->supplies); |
| 399 | if (ret != 0) { | 404 | if (ret != 0) { |
| 400 | dev_err(wm8994->dev, "Failed to get supplies: %d\n", ret); | 405 | dev_err(wm8994->dev, "Failed to get supplies: %d\n", ret); |
| @@ -405,7 +410,7 @@ static int wm8994_device_init(struct wm8994 *wm8994, int irq) | |||
| 405 | wm8994->supplies); | 410 | wm8994->supplies); |
| 406 | if (ret != 0) { | 411 | if (ret != 0) { |
| 407 | dev_err(wm8994->dev, "Failed to enable supplies: %d\n", ret); | 412 | dev_err(wm8994->dev, "Failed to enable supplies: %d\n", ret); |
| 408 | goto err; | 413 | goto err_regulator_free; |
| 409 | } | 414 | } |
| 410 | 415 | ||
| 411 | ret = wm8994_reg_read(wm8994, WM8994_SOFTWARE_RESET); | 416 | ret = wm8994_reg_read(wm8994, WM8994_SOFTWARE_RESET); |
| @@ -596,6 +601,8 @@ err_irq: | |||
| 596 | err_enable: | 601 | err_enable: |
| 597 | regulator_bulk_disable(wm8994->num_supplies, | 602 | regulator_bulk_disable(wm8994->num_supplies, |
| 598 | wm8994->supplies); | 603 | wm8994->supplies); |
| 604 | err_regulator_free: | ||
| 605 | regulator_bulk_free(wm8994->num_supplies, wm8994->supplies); | ||
| 599 | err: | 606 | err: |
| 600 | mfd_remove_devices(wm8994->dev); | 607 | mfd_remove_devices(wm8994->dev); |
| 601 | return ret; | 608 | return ret; |
| @@ -607,6 +614,7 @@ static void wm8994_device_exit(struct wm8994 *wm8994) | |||
| 607 | wm8994_irq_exit(wm8994); | 614 | wm8994_irq_exit(wm8994); |
| 608 | regulator_bulk_disable(wm8994->num_supplies, | 615 | regulator_bulk_disable(wm8994->num_supplies, |
| 609 | wm8994->supplies); | 616 | wm8994->supplies); |
| 617 | regulator_bulk_free(wm8994->num_supplies, wm8994->supplies); | ||
| 610 | mfd_remove_devices(wm8994->dev); | 618 | mfd_remove_devices(wm8994->dev); |
| 611 | } | 619 | } |
| 612 | 620 | ||
