Commit 60ba2fda authored by Krzysztof Kozlowski's avatar Krzysztof Kozlowski Committed by Mark Brown

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: default avatarKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20230418074630.8681-4-krzysztof.kozlowski@linaro.orgSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 92864de4
...@@ -4235,18 +4235,15 @@ static int wcd938x_populate_dt_data(struct wcd938x_priv *wcd938x, struct device ...@@ -4235,18 +4235,15 @@ static int wcd938x_populate_dt_data(struct wcd938x_priv *wcd938x, struct device
int ret; int ret;
wcd938x->reset_gpio = of_get_named_gpio(dev->of_node, "reset-gpios", 0); wcd938x->reset_gpio = of_get_named_gpio(dev->of_node, "reset-gpios", 0);
if (wcd938x->reset_gpio < 0) { if (wcd938x->reset_gpio < 0)
dev_err(dev, "Failed to get reset gpio: err = %d\n", return dev_err_probe(dev, wcd938x->reset_gpio,
wcd938x->reset_gpio); "Failed to get reset gpio\n");
return wcd938x->reset_gpio;
}
wcd938x->us_euro_gpio = devm_gpiod_get_optional(dev, "us-euro", wcd938x->us_euro_gpio = devm_gpiod_get_optional(dev, "us-euro",
GPIOD_OUT_LOW); GPIOD_OUT_LOW);
if (IS_ERR(wcd938x->us_euro_gpio)) { if (IS_ERR(wcd938x->us_euro_gpio))
dev_err(dev, "us-euro swap Control GPIO not found\n"); return dev_err_probe(dev, PTR_ERR(wcd938x->us_euro_gpio),
return PTR_ERR(wcd938x->us_euro_gpio); "us-euro swap Control GPIO not found\n");
}
cfg->swap_gnd_mic = wcd938x_swap_gnd_mic; cfg->swap_gnd_mic = wcd938x_swap_gnd_mic;
...@@ -4256,16 +4253,12 @@ static int wcd938x_populate_dt_data(struct wcd938x_priv *wcd938x, struct device ...@@ -4256,16 +4253,12 @@ static int wcd938x_populate_dt_data(struct wcd938x_priv *wcd938x, struct device
wcd938x->supplies[3].supply = "vdd-mic-bias"; wcd938x->supplies[3].supply = "vdd-mic-bias";
ret = regulator_bulk_get(dev, WCD938X_MAX_SUPPLY, wcd938x->supplies); ret = regulator_bulk_get(dev, WCD938X_MAX_SUPPLY, wcd938x->supplies);
if (ret) { if (ret)
dev_err(dev, "Failed to get supplies: err = %d\n", ret); return dev_err_probe(dev, ret, "Failed to get supplies\n");
return ret;
}
ret = regulator_bulk_enable(WCD938X_MAX_SUPPLY, wcd938x->supplies); ret = regulator_bulk_enable(WCD938X_MAX_SUPPLY, wcd938x->supplies);
if (ret) { if (ret)
dev_err(dev, "Failed to enable supplies: err = %d\n", ret); return dev_err_probe(dev, ret, "Failed to enable supplies\n");
return ret;
}
wcd938x_dt_parse_micbias_info(dev, wcd938x); wcd938x_dt_parse_micbias_info(dev, wcd938x);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment