Skip to content

Commit

Permalink
mfd: wm8994-core: Fix error path in wm8994_device_init
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-by: Richard Fitzgerald <[email protected]>
Signed-off-by: Lee Jones <[email protected]>
  • Loading branch information
anthonybrandon authored and Lee Jones committed Jul 27, 2018
1 parent bf1cafa commit df47df5
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions drivers/mfd/wm8994-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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) {
Expand All @@ -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;
}
}

Expand Down

0 comments on commit df47df5

Please sign in to comment.