Skip to content

Commit df47df5

Browse files
anthonybrandonLee Jones
authored andcommitted
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 <[email protected]> Reviewed-by: Richard Fitzgerald <[email protected]> Signed-off-by: Lee Jones <[email protected]>
1 parent bf1cafa commit df47df5

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

drivers/mfd/wm8994-core.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -513,14 +513,15 @@ static int wm8994_device_init(struct wm8994 *wm8994, int irq)
513513
break;
514514
default:
515515
dev_err(wm8994->dev, "Unknown device type %d\n", wm8994->type);
516-
return -EINVAL;
516+
ret = -EINVAL;
517+
goto err_enable;
517518
}
518519

519520
ret = regmap_reinit_cache(wm8994->regmap, regmap_config);
520521
if (ret != 0) {
521522
dev_err(wm8994->dev, "Failed to reinit register cache: %d\n",
522523
ret);
523-
return ret;
524+
goto err_enable;
524525
}
525526

526527
/* Explicitly put the device into reset in case regulators
@@ -531,7 +532,7 @@ static int wm8994_device_init(struct wm8994 *wm8994, int irq)
531532
wm8994_reg_read(wm8994, WM8994_SOFTWARE_RESET));
532533
if (ret != 0) {
533534
dev_err(wm8994->dev, "Failed to reset device: %d\n", ret);
534-
return ret;
535+
goto err_enable;
535536
}
536537

537538
if (regmap_patch) {
@@ -540,7 +541,7 @@ static int wm8994_device_init(struct wm8994 *wm8994, int irq)
540541
if (ret != 0) {
541542
dev_err(wm8994->dev, "Failed to register patch: %d\n",
542543
ret);
543-
goto err;
544+
goto err_enable;
544545
}
545546
}
546547

0 commit comments

Comments
 (0)