Re: [PATCH v1] ASoC: codecs: Switch to use dev_err_probe()

From: Krzysztof Kozlowski
Date: Fri Aug 30 2024 - 13:14:36 EST


On 30/08/2024 03:47, Yang Ruibin wrote:
> Using dev_err_probe() instead of dev_err() in probe() simplifies
> the error path and standardizes the format of the error code.
>
> Signed-off-by: Yang Ruibin <11162571@xxxxxxxx>
> ---
> sound/soc/codecs/ad1980.c | 8 +++-----
> sound/soc/codecs/adau1701.c | 19 +++++++------------
> sound/soc/codecs/ssm2602.c | 6 ++----
> 3 files changed, 12 insertions(+), 21 deletions(-)
>

...

> diff --git a/sound/soc/codecs/ssm2602.c b/sound/soc/codecs/ssm2602.c
> index c29324403..153eb55a3 100644
> --- a/sound/soc/codecs/ssm2602.c
> +++ b/sound/soc/codecs/ssm2602.c
> @@ -605,10 +605,8 @@ static int ssm260x_component_probe(struct snd_soc_component *component)
> int ret;
>
> ret = regmap_write(ssm2602->regmap, SSM2602_RESET, 0);
> - if (ret < 0) {
> - dev_err(component->dev, "Failed to issue reset: %d\n", ret);
> - return ret;
> - }
> + if (ret < 0)
> + return dev_err_probe(component->dev, ret, "Failed to issue reset\n");

After quick look, I think this might not be a probe path, thus the code
might not be correct.

Best regards,
Krzysztof