aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2013-11-05 12:40:00 -0500
committerMark Brown <broonie@linaro.org>2013-11-07 14:55:21 -0500
commit6c452bdac799e5ab94d658ea3517cfd57d832e6e (patch)
tree5125fc75cd1ea721ce7fa4946cbe106499faea73 /sound
parenta6ed0608bd289b45a9e42e3b0f33ff55bdac9b0f (diff)
ASoC: wm_adsp: Fix BUG_ON() and WARN_ON() usages
This patch does: - Move the sanity check with WARN_ON() in wm_adsp_region_to_reg() and remove the checks in the callers, - Fix wrong WARN_ON() usages, replaced with WARN(), - Fix unreachable or wrong BUG_ON() usages and replace with WARN_ON(). Signed-off-by: Takashi Iwai <tiwai@suse.de> Reviewed-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com> Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/codecs/wm_adsp.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/sound/soc/codecs/wm_adsp.c b/sound/soc/codecs/wm_adsp.c
index b38f3506418f..8dfce8f1ad2f 100644
--- a/sound/soc/codecs/wm_adsp.c
+++ b/sound/soc/codecs/wm_adsp.c
@@ -341,6 +341,8 @@ static struct wm_adsp_region const *wm_adsp_find_region(struct wm_adsp *dsp,
341static unsigned int wm_adsp_region_to_reg(struct wm_adsp_region const *region, 341static unsigned int wm_adsp_region_to_reg(struct wm_adsp_region const *region,
342 unsigned int offset) 342 unsigned int offset)
343{ 343{
344 if (WARN_ON(!region))
345 return offset;
344 switch (region->type) { 346 switch (region->type) {
345 case WMFW_ADSP1_PM: 347 case WMFW_ADSP1_PM:
346 return region->base + (offset * 3); 348 return region->base + (offset * 3);
@@ -353,7 +355,7 @@ static unsigned int wm_adsp_region_to_reg(struct wm_adsp_region const *region,
353 case WMFW_ADSP1_ZM: 355 case WMFW_ADSP1_ZM:
354 return region->base + (offset * 2); 356 return region->base + (offset * 2);
355 default: 357 default:
356 WARN_ON(NULL != "Unknown memory region type"); 358 WARN(1, "Unknown memory region type");
357 return offset; 359 return offset;
358 } 360 }
359} 361}
@@ -602,7 +604,7 @@ static int wm_adsp_load(struct wm_adsp *dsp)
602 break; 604 break;
603 605
604 default: 606 default:
605 BUG_ON(NULL == "Unknown DSP type"); 607 WARN(1, "Unknown DSP type");
606 goto out_fw; 608 goto out_fw;
607 } 609 }
608 610
@@ -642,27 +644,22 @@ static int wm_adsp_load(struct wm_adsp *dsp)
642 reg = offset; 644 reg = offset;
643 break; 645 break;
644 case WMFW_ADSP1_PM: 646 case WMFW_ADSP1_PM:
645 BUG_ON(!mem);
646 region_name = "PM"; 647 region_name = "PM";
647 reg = wm_adsp_region_to_reg(mem, offset); 648 reg = wm_adsp_region_to_reg(mem, offset);
648 break; 649 break;
649 case WMFW_ADSP1_DM: 650 case WMFW_ADSP1_DM:
650 BUG_ON(!mem);
651 region_name = "DM"; 651 region_name = "DM";
652 reg = wm_adsp_region_to_reg(mem, offset); 652 reg = wm_adsp_region_to_reg(mem, offset);
653 break; 653 break;
654 case WMFW_ADSP2_XM: 654 case WMFW_ADSP2_XM:
655 BUG_ON(!mem);
656 region_name = "XM"; 655 region_name = "XM";
657 reg = wm_adsp_region_to_reg(mem, offset); 656 reg = wm_adsp_region_to_reg(mem, offset);
658 break; 657 break;
659 case WMFW_ADSP2_YM: 658 case WMFW_ADSP2_YM:
660 BUG_ON(!mem);
661 region_name = "YM"; 659 region_name = "YM";
662 reg = wm_adsp_region_to_reg(mem, offset); 660 reg = wm_adsp_region_to_reg(mem, offset);
663 break; 661 break;
664 case WMFW_ADSP1_ZM: 662 case WMFW_ADSP1_ZM:
665 BUG_ON(!mem);
666 region_name = "ZM"; 663 region_name = "ZM";
667 reg = wm_adsp_region_to_reg(mem, offset); 664 reg = wm_adsp_region_to_reg(mem, offset);
668 break; 665 break;
@@ -901,10 +898,8 @@ static int wm_adsp_setup_algs(struct wm_adsp *dsp)
901 break; 898 break;
902 } 899 }
903 900
904 if (mem == NULL) { 901 if (WARN_ON(!mem))
905 BUG_ON(mem != NULL);
906 return -EINVAL; 902 return -EINVAL;
907 }
908 903
909 switch (dsp->type) { 904 switch (dsp->type) {
910 case WMFW_ADSP1: 905 case WMFW_ADSP1:
@@ -998,7 +993,7 @@ static int wm_adsp_setup_algs(struct wm_adsp *dsp)
998 break; 993 break;
999 994
1000 default: 995 default:
1001 BUG_ON(NULL == "Unknown DSP type"); 996 WARN(1, "Unknown DSP type");
1002 return -EINVAL; 997 return -EINVAL;
1003 } 998 }
1004 999