[PATCH] ASoC: rsnd: Emit useful error messages in .remove()

Kuninori Morimoto kuninori.morimoto.gx at renesas.com
Wed Jul 6 01:21:20 CEST 2022


Hi Uwe

Thank you for your patch

>  	for_each_rsnd_dai(rdai, priv, i) {
> -		ret |= rsnd_dai_call(remove, &rdai->playback, priv);
> -		ret |= rsnd_dai_call(remove, &rdai->capture, priv);
> +		int ret;
> +
> +		ret = rsnd_dai_call(remove, &rdai->playback, priv);
> +		if (ret)
> +			dev_warn(&pdev->dev, "Failed to remove playback dai #%d\n", i);
> +
> +		ret = rsnd_dai_call(remove, &rdai->capture, priv);
> +		if (ret)
> +			dev_warn(&pdev->dev, "Failed to remove capture dai #%d\n", i);
>  	}
>  
>  	for (i = 0; i < ARRAY_SIZE(remove_func); i++)
>  		remove_func[i](priv);
>  
> -	return ret;
> +	return 0;
>  }

I think we want to get return error ?

The reason why it was using |= is that it should call all function
without break even though it was error
(Maybe first/last error is very OK).

So, we want to is maybe like this (it uses last error)

	int ret = 0;

	for_each() {
		int __ret;

		__ret = xxx();
		if (__ret < 0) {
			...
=>			ret = __ret;
		}
	}

=>	return ret;


Thank you for your help !!

Best regards
---
Kuninori Morimoto


More information about the Alsa-devel mailing list