Re: [PATCH 1/2] ASoC: codecs: wcd938x: fix mux error handling

From: Johan Hovold
Date: Tue Apr 15 2025 - 09:45:55 EST


On Tue, Apr 15, 2025 at 12:00:33PM +0200, Markus Elfring wrote:
>
> > +++ b/sound/soc/codecs/wcd938x.c
> > @@ -3271,18 +3271,13 @@ static int wcd938x_populate_dt_data(struct wcd938x_priv *wcd938x, struct device
> > return dev_err_probe(dev, wcd938x->reset_gpio,
> > "Failed to get reset gpio\n");
> >
> > - wcd938x->us_euro_mux = devm_mux_control_get(dev, NULL);
> > - if (IS_ERR(wcd938x->us_euro_mux)) {
> > - if (PTR_ERR(wcd938x->us_euro_mux) == -EPROBE_DEFER)
> > - return -EPROBE_DEFER;
> > + if (of_property_present(dev->of_node, "mux-controls")) {
> > + wcd938x->us_euro_mux = devm_mux_control_get(dev, NULL);
> > + if (IS_ERR(wcd938x->us_euro_mux)) {
> > + ret = PTR_ERR(wcd938x->us_euro_mux);
> > + return dev_err_probe(dev, ret, "failed to get mux control\n");
> > + }
>
> May the error code assignment statement be omitted here together with extra curly brackets
> (as such a case is demonstrated in a subsequent if branch)?

I considered that, but I prefer using a temporary variable as it is more
readable.

>
> + return dev_err_probe(dev, PTR_ERR(wcd938x->us_euro_mux),
> + "failed to get mux control\n");

Johan