ASoC: codecs: wcd938x: Simplify with dev_err_probe

Replace dev_err() in probe() path with dev_err_probe() to:
1. Make code a bit simpler and easier to read,
2. Do not print messages on deferred probe.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20230418074630.8681-4-krzysztof.kozlowski@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Krzysztof Kozlowski 2023-04-18 09:46:30 +02:00 committed by Mark Brown
parent 92864de45c
commit 60ba2fda52
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0

View File

@ -4235,18 +4235,15 @@ static int wcd938x_populate_dt_data(struct wcd938x_priv *wcd938x, struct device
int ret;
wcd938x->reset_gpio = of_get_named_gpio(dev->of_node, "reset-gpios", 0);
if (wcd938x->reset_gpio < 0) {
dev_err(dev, "Failed to get reset gpio: err = %d\n",
wcd938x->reset_gpio);
return wcd938x->reset_gpio;
}
if (wcd938x->reset_gpio < 0)
return dev_err_probe(dev, wcd938x->reset_gpio,
"Failed to get reset gpio\n");
wcd938x->us_euro_gpio = devm_gpiod_get_optional(dev, "us-euro",
GPIOD_OUT_LOW);
if (IS_ERR(wcd938x->us_euro_gpio)) {
dev_err(dev, "us-euro swap Control GPIO not found\n");
return PTR_ERR(wcd938x->us_euro_gpio);
}
if (IS_ERR(wcd938x->us_euro_gpio))
return dev_err_probe(dev, PTR_ERR(wcd938x->us_euro_gpio),
"us-euro swap Control GPIO not found\n");
cfg->swap_gnd_mic = wcd938x_swap_gnd_mic;
@ -4256,16 +4253,12 @@ static int wcd938x_populate_dt_data(struct wcd938x_priv *wcd938x, struct device
wcd938x->supplies[3].supply = "vdd-mic-bias";
ret = regulator_bulk_get(dev, WCD938X_MAX_SUPPLY, wcd938x->supplies);
if (ret) {
dev_err(dev, "Failed to get supplies: err = %d\n", ret);
return ret;
}
if (ret)
return dev_err_probe(dev, ret, "Failed to get supplies\n");
ret = regulator_bulk_enable(WCD938X_MAX_SUPPLY, wcd938x->supplies);
if (ret) {
dev_err(dev, "Failed to enable supplies: err = %d\n", ret);
return ret;
}
if (ret)
return dev_err_probe(dev, ret, "Failed to enable supplies\n");
wcd938x_dt_parse_micbias_info(dev, wcd938x);