[alsa-devel] [PATCH 3/6] bebob: Add dev_err() for debugging

Takashi Iwai tiwai at suse.de
Mon Jul 21 12:02:59 CEST 2014


At Mon, 21 Jul 2014 11:10:02 +0900,
Takashi Sakamoto wrote:
> 
> This commit adds some dev_err() to help debug when
> avc_maudio_set_special_clk() failed.
> 
> Signed-off-by: Takashi Sakamoto <o-takashi at sakamocchi.jp>
> ---
>  sound/firewire/bebob/bebob_maudio.c | 20 +++++++++++++++++---
>  1 file changed, 17 insertions(+), 3 deletions(-)
> 
> diff --git a/sound/firewire/bebob/bebob_maudio.c b/sound/firewire/bebob/bebob_maudio.c
> index 83f8d5b..008ff2c 100644
> --- a/sound/firewire/bebob/bebob_maudio.c
> +++ b/sound/firewire/bebob/bebob_maudio.c
> @@ -393,6 +393,10 @@ static int special_clk_ctl_set(struct snd_kcontrol *kctl,
>  
>  	mutex_unlock(&bebob->mutex);
>  
> +	if (err < 0)
> +		dev_err(&bebob->unit->device,
> +			"fail to change clock source: %d\n", err);
> +

The error message at the end of put callback is often useless.
If it's an error, it's notified to user-space and you'll see the error
there.  The unconditional error message via dev_err() may flood the
kernel messages, too.

For the debugging purpose, rather put dev_dbg() to each point
receiving an error and give the individual message.


thanks,

Takashi

>  	return err >= 0;
>  }
>  static struct snd_kcontrol_new special_clk_ctl = {
> @@ -506,7 +510,14 @@ static int special_dig_in_iface_ctl_set(struct snd_kcontrol *kctl,
>  					 dig_in_fmt,
>  					 params->dig_out_fmt,
>  					 params->clk_lock);
> -	if ((err < 0) || (params->dig_in_fmt > 0)) /* ADAT */
> +	if (err < 0) {
> +		dev_err(&bebob->unit->device,
> +			"fail to change clock source: %d\n", err);
> +		goto end;
> +	}
> +
> +	/* For ADAT, optical interface is only available. */
> +	if (params->dig_in_fmt > 0)
>  		goto end;
>  
>  	err = avc_audio_set_selector(bebob->unit, 0x00, 0x04, dig_in_iface);
> @@ -567,10 +578,13 @@ static int special_dig_out_iface_ctl_set(struct snd_kcontrol *kctl,
>  					 params->clk_src,
>  					 params->dig_in_fmt,
>  					 id, params->clk_lock);
> -	if (err >= 0)
> -		special_stream_formation_set(bebob);
>  
>  	mutex_unlock(&bebob->mutex);
> +
> +	if (err < 0)
> +		dev_err(&bebob->unit->device,
> +			"fail to change digital output interface: %d\n", err);
> +
>  	return err;
>  }
>  static struct snd_kcontrol_new special_dig_out_iface_ctl = {
> -- 
> 1.9.1
> 


More information about the Alsa-devel mailing list