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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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



[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Pulse Audio]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux