Kill BUG() for ASoC
Subsystems (3)
cover Kill BUG() for ASoC
Hi,
this is the revised patches for replacing BUG() with WARN(). Indeed this gives even better information than a simple BUG(), so drop the previous patches to replace snd_BUG().
[PATCH 1/9] ASoC: wm5100: Replace BUG() with WARN() [PATCH 2/9] ASoC: wm8350: Replace BUG() with WARN() [PATCH 3/9] ASoC: wm8900: Replace BUG() with WARN() [PATCH 4/9] ASoC: wm8904: Replace BUG() with WARN() [PATCH 5/9] ASoC: wm8958: Replace BUG() with WARN() [PATCH 6/9] ASoC: wm8962: Replace BUG() with WARN() [PATCH 7/9] ASoC: wm8996: Replace BUG() with WARN() [PATCH 8/9] ASoC: wm_hubs: Replace BUG() with WARN() [PATCH 9/9] ASoC: Replace BUG() with WARN()
thanks,
Takashi
PATCH 1/9 ASoC: wm5100: Replace BUG() with WARN()
BUG() used in the driver is just to spit the stack trace on buggy points, not really needed to stop the whole operation. For that purpose, it'd be more convenient to use WARN() instead with more error information.
--- sound/soc/codecs/wm5100.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/codecs/wm5100.c +1 -1
@@ -1621,7 +1621,7 @@ static int wm5100_set_sysclk(struct snd_soc_codec *codec, int clk_id,break ;default : -BUG (); +WARN (1 ,"Invalid freq %d\n" , freq); audio_rate =0 ;break ; }
Signature · 1 line
1.8.4.2
PATCH 2/9 ASoC: wm8350: Replace BUG() with WARN()
In reply to Takashi IwaiBUG() used in the driver is just to spit the stack trace on buggy points, not really needed to stop the whole operation. For that purpose, it'd be more convenient to use WARN() instead with more error information.
--- sound/soc/codecs/wm8350.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/codecs/wm8350.c +1 -1
@@ -274,7 +274,7 @@ static int pga_event(struct snd_soc_dapm_widget *w,break ;default : -BUG (); +WARN (1 ,"Invalid shift %d\n" , w->shift);return -1 ; }
Signature · 1 line
1.8.4.2
Re: [PATCH 2/9] ASoC: wm8350: Replace BUG() with WARN()
Quoted 4 lines · Takashi Iwai
BUG()used in the driver is just to spit the stack trace on buggy points, not really needed to stop the whole operation. For that purpose, it'd be more convenient to useWARN()instead with more error information.
Applied all, thanks.
PATCH 3/9 ASoC: wm8900: Replace BUG() with WARN()
In reply to Takashi IwaiBUG() used in the driver is just to spit the stack trace on buggy points, not really needed to stop the whole operation. For that purpose, it'd be more convenient to use WARN() instead with more error information.
--- sound/soc/codecs/wm8900.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
sound/soc/codecs/wm8900.c +2 -1
@@ -279,7 +279,8 @@ static int wm8900_hp_event(struct snd_soc_dapm_widget *w,break ;default : -BUG (); +WARN (1 ,"Invalid event %d\n" , event); +break ; }return 0 ;
Signature · 1 line
1.8.4.2
PATCH 4/9 ASoC: wm8904: Replace BUG() with WARN()
In reply to Takashi IwaiBUG() used in the driver is just to spit the stack trace on buggy points, not really needed to stop the whole operation. For that purpose, it'd be more convenient to use WARN() instead with more error information.
--- sound/soc/codecs/wm8904.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/codecs/wm8904.c +1 -1
@@ -741,7 +741,7 @@ static int out_pga_event(struct snd_soc_dapm_widget *w, dcs_r =3 ;break ;default : -BUG (); +WARN (1 ,"Invalid reg %d\n" , reg);return -EINVAL ; }
Signature · 1 line
1.8.4.2
PATCH 5/9 ASoC: wm8958: Replace BUG() with WARN()
In reply to Takashi IwaiBUG() used in the driver is just to spit the stack trace on buggy points, not really needed to stop the whole operation. For that purpose, it'd be more convenient to use WARN() instead with more error information.
--- sound/soc/codecs/wm8958-dsp2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/codecs/wm8958-dsp2.c +1 -1
@@ -348,7 +348,7 @@ static void wm8958_dsp_apply(struct snd_soc_codec *codec, int path, int start) aif =1 ;break ;default : -BUG (); +WARN (1 ,"Invalid path %d\n" , path);return ; }
Signature · 1 line
1.8.4.2
PATCH 6/9 ASoC: wm8962: Replace BUG() with WARN()
In reply to Takashi IwaiBUG() used in the driver is just to spit the stack trace on buggy points, not really needed to stop the whole operation. For that purpose, it'd be more convenient to use WARN() instead with more error information.
--- sound/soc/codecs/wm8962.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
sound/soc/codecs/wm8962.c +5 -5
@@ -1853,7 +1853,7 @@ static int cp_event(struct snd_soc_dapm_widget *w,break ;default : -BUG (); +WARN (1 ,"Invalid event %d\n" , event);return -EINVAL ; }
@@ -1945,7 +1945,7 @@ static int hp_event(struct snd_soc_dapm_widget *w,break ;default : -BUG (); +WARN (1 ,"Invalid event %d\n" , event);return -EINVAL ; }
@@ -1974,7 +1974,7 @@ static int out_pga_event(struct snd_soc_dapm_widget *w, reg =WM8962_SPKOUTL_VOLUME ;break ;default : -BUG (); +WARN (1 ,"Invalid shift %d\n" , w->shift);return -EINVAL ; }
@@ -1982,7 +1982,7 @@ static int out_pga_event(struct snd_soc_dapm_widget *w,case SND_SOC_DAPM_POST_PMU :return snd_soc_write (codec, reg,snd_soc_read (codec, reg));default : -BUG (); +WARN (1 ,"Invalid event %d\n" , event);return -EINVAL ; } }
@@ -2005,7 +2005,7 @@ static int dsp2_event(struct snd_soc_dapm_widget *w,break ;default : -BUG (); +WARN (1 ,"Invalid event %d\n" , event);return -EINVAL ; }
Signature · 1 line
1.8.4.2
PATCH 7/9 ASoC: wm8996: Replace BUG() with WARN()
In reply to Takashi IwaiBUG() used in the driver is just to spit the stack trace on buggy points, not really needed to stop the whole operation. For that purpose, it'd be more convenient to use WARN() instead with more error information.
--- sound/soc/codecs/wm8996.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
sound/soc/codecs/wm8996.c +6 -6
@@ -610,7 +610,7 @@ static int bg_event(struct snd_soc_dapm_widget *w,wm8996_bg_disable (codec);break ;default : -BUG (); +WARN (1 ,"Invalid event %d\n" , event); ret = -EINVAL ; }
@@ -627,7 +627,7 @@ static int cp_event(struct snd_soc_dapm_widget *w,msleep (5 );break ;default : -BUG (); +WARN (1 ,"Invalid event %d\n" , event); ret = -EINVAL ; }
@@ -648,7 +648,7 @@ static int rmv_short_event(struct snd_soc_dapm_widget *w, wm8996->hpout_pending |= w->shift;break ;default : -BUG (); +WARN (1 ,"Invalid event %d\n" , event);return -EINVAL ; }
@@ -769,7 +769,7 @@ static int dcs_start(struct snd_soc_dapm_widget *w, wm8996->dcs_pending |=1 << w->shift;break ;default : -BUG (); +WARN (1 ,"Invalid event %d\n" , event);return -EINVAL ; }
@@ -1658,7 +1658,7 @@ static int wm8996_set_fmt(struct snd_soc_dai *dai, unsigned int fmt) lrclk_rx_reg =WM8996_AIF2_RX_LRCLK_2 ;break ;default : -BUG (); +WARN (1 ,"Invalid dai id %d\n" , dai->id);return -EINVAL ; }
@@ -1770,7 +1770,7 @@ static int wm8996_hw_params(struct snd_pcm_substream *substream, dsp_shift =WM8996_DSP2_DIV_SHIFT ;break ;default : -BUG (); +WARN (1 ,"Invalid dai id %d\n" , dai->id);return -EINVAL ; }
Signature · 1 line
1.8.4.2
PATCH 8/9 ASoC: wm_hubs: Replace BUG() with WARN()
In reply to Takashi IwaiBUG() used in the driver is just to spit the stack trace on buggy points, not really needed to stop the whole operation. For that purpose, it'd be more convenient to use WARN() instead with more error information.
--- sound/soc/codecs/wm_hubs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/codecs/wm_hubs.c +1 -1
@@ -611,7 +611,7 @@ static int earpiece_event(struct snd_soc_dapm_widget *w,break ;default : -BUG (); +WARN (1 ,"Invalid event %d\n" , event);break ; }
Signature · 1 line
1.8.4.2
PATCH 9/9 ASoC: Replace BUG() with WARN()
In reply to Takashi IwaiBUG() used in the driver is just to spit the stack trace on buggy points, not really needed to stop the whole operation. For that purpose, it'd be more convenient to use WARN() instead with more error information.
--- sound/soc/soc-cache.c | 6 ++++-- sound/soc/soc-dapm.c | 6 +++--- 2 files changed, 7 insertions(+), 5 deletions(-)
sound/soc/soc-cache.c +4 -2
@@ -36,7 +36,8 @@ static bool snd_soc_set_cache_val(void *base, unsigned int idx,break ; }default : -BUG (); +WARN (1 ,"Invalid word_size %d\n" , word_size); +break ; }return false; }
@@ -57,7 +58,8 @@ static unsigned int snd_soc_get_cache_val(const void *base, unsigned int idx,return cache[idx]; }default : -BUG (); +WARN (1 ,"Invalid word_size %d\n" , word_size); +break ; }/* unreachable */ return -1 ;
sound/soc/soc-dapm.c +3 -3
@@ -1427,7 +1427,7 @@ static void dapm_seq_check_event(struct snd_soc_card *card, power =0 ;break ;default : -BUG (); +WARN (1 ,"Unknown event %d\n" , event);return ; }
@@ -2027,7 +2027,7 @@ static ssize_t dapm_bias_read_file(struct file *file, char __user *user_buf, level ="Off\n" ;break ;default : -BUG (); +WARN (1 ,"Unknown bias_level %d\n" , dapm->bias_level); level ="Unknown\n" ;break ; }
@@ -3452,7 +3452,7 @@ static int snd_soc_dai_link_event(struct snd_soc_dapm_widget *w,break ;default : -BUG (); +WARN (1 ,"Unknown event %d\n" , event);return -EINVAL ; }
Signature · 1 line
1.8.4.2