aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/cs46xx/dsp_spos.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/pci/cs46xx/dsp_spos.c')
-rw-r--r--sound/pci/cs46xx/dsp_spos.c51
1 files changed, 34 insertions, 17 deletions
diff --git a/sound/pci/cs46xx/dsp_spos.c b/sound/pci/cs46xx/dsp_spos.c
index ccc8bedb5b1a..f4f0c8f5dad7 100644
--- a/sound/pci/cs46xx/dsp_spos.c
+++ b/sound/pci/cs46xx/dsp_spos.c
@@ -63,7 +63,8 @@ static int shadow_and_reallocate_code (struct snd_cs46xx * chip, u32 * data, u32
63 u32 mop_operands,mop_type,wide_op; 63 u32 mop_operands,mop_type,wide_op;
64 struct dsp_spos_instance * ins = chip->dsp_spos_instance; 64 struct dsp_spos_instance * ins = chip->dsp_spos_instance;
65 65
66 snd_assert( ((size % 2) == 0), return -EINVAL); 66 if (snd_BUG_ON(size %2))
67 return -EINVAL;
67 68
68 while (i < size) { 69 while (i < size) {
69 loval = data[i++]; 70 loval = data[i++];
@@ -289,7 +290,8 @@ void cs46xx_dsp_spos_destroy (struct snd_cs46xx * chip)
289 int i; 290 int i;
290 struct dsp_spos_instance * ins = chip->dsp_spos_instance; 291 struct dsp_spos_instance * ins = chip->dsp_spos_instance;
291 292
292 snd_assert(ins != NULL, return); 293 if (snd_BUG_ON(!ins))
294 return;
293 295
294 mutex_lock(&chip->spos_mutex); 296 mutex_lock(&chip->spos_mutex);
295 for (i = 0; i < ins->nscb; ++i) { 297 for (i = 0; i < ins->nscb; ++i) {
@@ -404,7 +406,8 @@ int cs46xx_dsp_load_module (struct snd_cs46xx * chip, struct dsp_module_desc * m
404 406
405 /* if module has a code segment it must have 407 /* if module has a code segment it must have
406 symbol table */ 408 symbol table */
407 snd_assert(module->symbol_table.symbols != NULL ,return -ENOMEM); 409 if (snd_BUG_ON(!module->symbol_table.symbols))
410 return -ENOMEM;
408 if (add_symbols(chip,module)) { 411 if (add_symbols(chip,module)) {
409 snd_printk(KERN_ERR "dsp_spos: failed to load symbol table\n"); 412 snd_printk(KERN_ERR "dsp_spos: failed to load symbol table\n");
410 return -ENOMEM; 413 return -ENOMEM;
@@ -1369,7 +1372,8 @@ int cs46xx_dsp_scb_and_task_init (struct snd_cs46xx *chip)
1369 1372
1370 valid_slots = snd_cs46xx_peekBA0(chip, BA0_ACOSV); 1373 valid_slots = snd_cs46xx_peekBA0(chip, BA0_ACOSV);
1371 1374
1372 snd_assert (chip->nr_ac97_codecs == 1 || chip->nr_ac97_codecs == 2); 1375 if (snd_BUG_ON(chip->nr_ac97_codecs != 1 && chip->nr_ac97_codecs != 2))
1376 goto _fail_end;
1373 1377
1374 if (chip->nr_ac97_codecs == 1) { 1378 if (chip->nr_ac97_codecs == 1) {
1375 /* output on slot 5 and 11 1379 /* output on slot 5 and 11
@@ -1609,11 +1613,14 @@ static int cs46xx_dsp_async_init (struct snd_cs46xx *chip,
1609 1613
1610 spdifo_scb_desc = cs46xx_dsp_create_scb(chip,"SPDIFOSCB",(u32 *)&spdifo_scb,SPDIFO_SCB_INST); 1614 spdifo_scb_desc = cs46xx_dsp_create_scb(chip,"SPDIFOSCB",(u32 *)&spdifo_scb,SPDIFO_SCB_INST);
1611 1615
1612 snd_assert(spdifo_scb_desc, return -EIO); 1616 if (snd_BUG_ON(!spdifo_scb_desc))
1617 return -EIO;
1613 spdifi_scb_desc = cs46xx_dsp_create_scb(chip,"SPDIFISCB",(u32 *)&spdifi_scb,SPDIFI_SCB_INST); 1618 spdifi_scb_desc = cs46xx_dsp_create_scb(chip,"SPDIFISCB",(u32 *)&spdifi_scb,SPDIFI_SCB_INST);
1614 snd_assert(spdifi_scb_desc, return -EIO); 1619 if (snd_BUG_ON(!spdifi_scb_desc))
1620 return -EIO;
1615 async_codec_scb_desc = cs46xx_dsp_create_scb(chip,"AsynCodecInputSCB",(u32 *)&async_codec_input_scb, HFG_TREE_SCB); 1621 async_codec_scb_desc = cs46xx_dsp_create_scb(chip,"AsynCodecInputSCB",(u32 *)&async_codec_input_scb, HFG_TREE_SCB);
1616 snd_assert(async_codec_scb_desc, return -EIO); 1622 if (snd_BUG_ON(!async_codec_scb_desc))
1623 return -EIO;
1617 1624
1618 async_codec_scb_desc->parent_scb_ptr = NULL; 1625 async_codec_scb_desc->parent_scb_ptr = NULL;
1619 async_codec_scb_desc->next_scb_ptr = spdifi_scb_desc; 1626 async_codec_scb_desc->next_scb_ptr = spdifi_scb_desc;
@@ -1698,8 +1705,10 @@ int cs46xx_dsp_enable_spdif_in (struct snd_cs46xx *chip)
1698 chip->active_ctrl(chip, 1); 1705 chip->active_ctrl(chip, 1);
1699 chip->amplifier_ctrl(chip, 1); 1706 chip->amplifier_ctrl(chip, 1);
1700 1707
1701 snd_assert (ins->asynch_rx_scb == NULL,return -EINVAL); 1708 if (snd_BUG_ON(ins->asynch_rx_scb))
1702 snd_assert (ins->spdif_in_src != NULL,return -EINVAL); 1709 return -EINVAL;
1710 if (snd_BUG_ON(!ins->spdif_in_src))
1711 return -EINVAL;
1703 1712
1704 mutex_lock(&chip->spos_mutex); 1713 mutex_lock(&chip->spos_mutex);
1705 1714
@@ -1754,8 +1763,10 @@ int cs46xx_dsp_disable_spdif_in (struct snd_cs46xx *chip)
1754{ 1763{
1755 struct dsp_spos_instance * ins = chip->dsp_spos_instance; 1764 struct dsp_spos_instance * ins = chip->dsp_spos_instance;
1756 1765
1757 snd_assert (ins->asynch_rx_scb != NULL, return -EINVAL); 1766 if (snd_BUG_ON(!ins->asynch_rx_scb))
1758 snd_assert (ins->spdif_in_src != NULL,return -EINVAL); 1767 return -EINVAL;
1768 if (snd_BUG_ON(!ins->spdif_in_src))
1769 return -EINVAL;
1759 1770
1760 mutex_lock(&chip->spos_mutex); 1771 mutex_lock(&chip->spos_mutex);
1761 1772
@@ -1780,8 +1791,10 @@ int cs46xx_dsp_enable_pcm_capture (struct snd_cs46xx *chip)
1780{ 1791{
1781 struct dsp_spos_instance * ins = chip->dsp_spos_instance; 1792 struct dsp_spos_instance * ins = chip->dsp_spos_instance;
1782 1793
1783 snd_assert (ins->pcm_input == NULL,return -EINVAL); 1794 if (snd_BUG_ON(ins->pcm_input))
1784 snd_assert (ins->ref_snoop_scb != NULL,return -EINVAL); 1795 return -EINVAL;
1796 if (snd_BUG_ON(!ins->ref_snoop_scb))
1797 return -EINVAL;
1785 1798
1786 mutex_lock(&chip->spos_mutex); 1799 mutex_lock(&chip->spos_mutex);
1787 ins->pcm_input = cs46xx_add_record_source(chip,ins->ref_snoop_scb,PCMSERIALIN_PCM_SCB_ADDR, 1800 ins->pcm_input = cs46xx_add_record_source(chip,ins->ref_snoop_scb,PCMSERIALIN_PCM_SCB_ADDR,
@@ -1795,7 +1808,8 @@ int cs46xx_dsp_disable_pcm_capture (struct snd_cs46xx *chip)
1795{ 1808{
1796 struct dsp_spos_instance * ins = chip->dsp_spos_instance; 1809 struct dsp_spos_instance * ins = chip->dsp_spos_instance;
1797 1810
1798 snd_assert (ins->pcm_input != NULL,return -EINVAL); 1811 if (snd_BUG_ON(!ins->pcm_input))
1812 return -EINVAL;
1799 1813
1800 mutex_lock(&chip->spos_mutex); 1814 mutex_lock(&chip->spos_mutex);
1801 cs46xx_dsp_remove_scb (chip,ins->pcm_input); 1815 cs46xx_dsp_remove_scb (chip,ins->pcm_input);
@@ -1809,8 +1823,10 @@ int cs46xx_dsp_enable_adc_capture (struct snd_cs46xx *chip)
1809{ 1823{
1810 struct dsp_spos_instance * ins = chip->dsp_spos_instance; 1824 struct dsp_spos_instance * ins = chip->dsp_spos_instance;
1811 1825
1812 snd_assert (ins->adc_input == NULL,return -EINVAL); 1826 if (snd_BUG_ON(ins->adc_input))
1813 snd_assert (ins->codec_in_scb != NULL,return -EINVAL); 1827 return -EINVAL;
1828 if (snd_BUG_ON(!ins->codec_in_scb))
1829 return -EINVAL;
1814 1830
1815 mutex_lock(&chip->spos_mutex); 1831 mutex_lock(&chip->spos_mutex);
1816 ins->adc_input = cs46xx_add_record_source(chip,ins->codec_in_scb,PCMSERIALIN_SCB_ADDR, 1832 ins->adc_input = cs46xx_add_record_source(chip,ins->codec_in_scb,PCMSERIALIN_SCB_ADDR,
@@ -1824,7 +1840,8 @@ int cs46xx_dsp_disable_adc_capture (struct snd_cs46xx *chip)
1824{ 1840{
1825 struct dsp_spos_instance * ins = chip->dsp_spos_instance; 1841 struct dsp_spos_instance * ins = chip->dsp_spos_instance;
1826 1842
1827 snd_assert (ins->adc_input != NULL,return -EINVAL); 1843 if (snd_BUG_ON(!ins->adc_input))
1844 return -EINVAL;
1828 1845
1829 mutex_lock(&chip->spos_mutex); 1846 mutex_lock(&chip->spos_mutex);
1830 cs46xx_dsp_remove_scb (chip,ins->adc_input); 1847 cs46xx_dsp_remove_scb (chip,ins->adc_input);