From: Krzysztof Kozlowski Date: Wed, 12 Jun 2024 16:15:23 +0000 (+0200) Subject: ASoC: codecs: wcd934x: Handle nicer probe deferral and simplify with dev_err_probe() X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=9ea22713227397b56a2b36a68c8bda13f0b43d70;p=users%2Fjedix%2Flinux-maple.git ASoC: codecs: wcd934x: Handle nicer probe deferral and simplify with dev_err_probe() wcd934x_codec_parse_data() function is called only from probe(), so printing errors on resource acquisition is discouraged, because it can pollute dmesg in case of probe deferral. The actual deferral is here unlikely, but still the code is a bit simpler with dev_err_probe(). Signed-off-by: Krzysztof Kozlowski Link: https://msgid.link/r/20240612-asoc-wcd9xxx-wide-cleanups-v1-10-0d15885b2a06@linaro.org Signed-off-by: Mark Brown --- diff --git a/sound/soc/codecs/wcd934x.c b/sound/soc/codecs/wcd934x.c index 2a5fb4370ba3e..d1bbc963856b9 100644 --- a/sound/soc/codecs/wcd934x.c +++ b/sound/soc/codecs/wcd934x.c @@ -5856,17 +5856,13 @@ static int wcd934x_codec_parse_data(struct wcd934x_codec *wcd) struct device_node *ifc_dev_np; ifc_dev_np = of_parse_phandle(dev->of_node, "slim-ifc-dev", 0); - if (!ifc_dev_np) { - dev_err(dev, "No Interface device found\n"); - return -EINVAL; - } + if (!ifc_dev_np) + return dev_err_probe(dev, -EINVAL, "No Interface device found\n"); wcd->sidev = of_slim_get_device(wcd->sdev->ctrl, ifc_dev_np); of_node_put(ifc_dev_np); - if (!wcd->sidev) { - dev_err(dev, "Unable to get SLIM Interface device\n"); - return -EINVAL; - } + if (!wcd->sidev) + return dev_err_probe(dev, -EINVAL, "Unable to get SLIM Interface device\n"); slim_get_logical_addr(wcd->sidev); wcd->if_regmap = regmap_init_slimbus(wcd->sidev, @@ -5912,10 +5908,8 @@ static int wcd934x_codec_probe(struct platform_device *pdev) mutex_init(&wcd->micb_lock); ret = wcd934x_codec_parse_data(wcd); - if (ret) { - dev_err(wcd->dev, "Failed to get SLIM IRQ\n"); + if (ret) return ret; - } /* set default rate 9P6MHz */ regmap_update_bits(wcd->regmap, WCD934X_CODEC_RPM_CLK_MCLK_CFG,