diff options
author | Anthony Brandon <anthony@amarulasolutions.com> | 2018-06-14 13:57:14 +0200 |
---|---|---|
committer | Lee Jones <lee.jones@linaro.org> | 2018-07-27 08:13:24 +0100 |
commit | df47df55911b31863bcbed93df163cb27298e311 (patch) | |
tree | 3e16e5424fc79a1fbaef2a6f9155dad38f6ccc8c /drivers/mfd/wm8994-core.c | |
parent | bf1cafa18be3b73ad30a3bbf2c3dae5ef333189a (diff) |
mfd: wm8994-core: Fix error path in wm8994_device_init
For some errors, the wm8994_device_init function was returning or
jumping to the wrong point in the error path.
Signed-off-by: Anthony Brandon <anthony@amarulasolutions.com>
Reviewed-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Diffstat (limited to 'drivers/mfd/wm8994-core.c')
-rw-r--r-- | drivers/mfd/wm8994-core.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/mfd/wm8994-core.c b/drivers/mfd/wm8994-core.c index 5d5888ee2966..a944841a55cb 100644 --- a/drivers/mfd/wm8994-core.c +++ b/drivers/mfd/wm8994-core.c @@ -513,14 +513,15 @@ static int wm8994_device_init(struct wm8994 *wm8994, int irq) break; default: dev_err(wm8994->dev, "Unknown device type %d\n", wm8994->type); - return -EINVAL; + ret = -EINVAL; + goto err_enable; } ret = regmap_reinit_cache(wm8994->regmap, regmap_config); if (ret != 0) { dev_err(wm8994->dev, "Failed to reinit register cache: %d\n", ret); - return ret; + goto err_enable; } /* Explicitly put the device into reset in case regulators @@ -531,7 +532,7 @@ static int wm8994_device_init(struct wm8994 *wm8994, int irq) wm8994_reg_read(wm8994, WM8994_SOFTWARE_RESET)); if (ret != 0) { dev_err(wm8994->dev, "Failed to reset device: %d\n", ret); - return ret; + goto err_enable; } if (regmap_patch) { @@ -540,7 +541,7 @@ static int wm8994_device_init(struct wm8994 *wm8994, int irq) if (ret != 0) { dev_err(wm8994->dev, "Failed to register patch: %d\n", ret); - goto err; + goto err_enable; } } |