ALSA: cs46xx: Adjustments for some function implementations
Subsystems (2)
cover ALSA: cs46xx: Adjustments for some function implementations
From: Markus Elfring <[email protected]>
Date: Mon, 13 Nov 2017 19:14:56 +0100
A few update suggestions were taken into account
from static source code analysis.
Markus Elfring (4):
Adjust 33 function calls together with a variable assignment Use common error handling code in two functions
Improve a size determination in cs46xx_dsp_proc_register_scb_desc() Adjust 35 checks for null pointers
sound/pci/cs46xx/cs46xx.c | 75 ++++++++++---------- sound/pci/cs46xx/cs46xx_lib.c | 134 +++++++++++++++++++++--------------- sound/pci/cs46xx/dsp_spos.c | 60 +++++++++------- sound/pci/cs46xx/dsp_spos_scb_lib.c | 36 +++++----- 4 files changed, 166 insertions(+), 139 deletions(-)
Signature · 1 line
2.15.0
PATCH 1/4 ALSA: cs46xx: Adjust 33 function calls together with a variable assignment
From: Markus Elfring <[email protected]>
Date: Mon, 13 Nov 2017 18:50:19 +0100
The script "checkpatch.pl" pointed information out like the following.
ERROR: do not use assignment in if condition
Thus fix the affected source code places.
--- sound/pci/cs46xx/cs46xx.c | 31 ++++++++++------ sound/pci/cs46xx/cs46xx_lib.c | 71 ++++++++++++++++++++++++------------- sound/pci/cs46xx/dsp_spos.c | 29 ++++++++++----- sound/pci/cs46xx/dsp_spos_scb_lib.c | 7 ++-- 4 files changed, 92 insertions(+), 46 deletions(-)
sound/pci/cs46xx/cs46xx.c +20 -11
@@ -92,45 +92,53 @@ static int snd_card_cs46xx_probe(struct pci_dev *pci, 0, &card);if (err <0 )return err; -if ((err =snd_cs46xx_create (card, pci, - external_amp[dev], thinkpad[dev], - &chip)) <0 ) { + + err =snd_cs46xx_create (card, pci, external_amp[dev], + thinkpad[dev], &chip); +if (err <0 ) {snd_card_free (card);return err; } card->private_data = chip; chip->accept_valid = mmap_valid[dev]; -if ((err =snd_cs46xx_pcm (chip,0 )) <0 ) { + err =snd_cs46xx_pcm (chip,0 ); +if (err <0 ) {snd_card_free (card);return err; }#ifdef CONFIG_SND_CS46XX_NEW_DSP -if ((err =snd_cs46xx_pcm_rear (chip,1 )) <0 ) { + err =snd_cs46xx_pcm_rear (chip,1 ); +if (err <0 ) {snd_card_free (card);return err; } -if ((err =snd_cs46xx_pcm_iec958 (chip,2 )) <0 ) { + err =snd_cs46xx_pcm_iec958 (chip,2 ); +if (err <0 ) {snd_card_free (card);return err; }#endif -if ((err =snd_cs46xx_mixer (chip,2 )) <0 ) { + err =snd_cs46xx_mixer (chip,2 ); +if (err <0 ) {snd_card_free (card);return err; }#ifdef CONFIG_SND_CS46XX_NEW_DSP if (chip->nr_ac97_codecs =2 ) { -if ((err =snd_cs46xx_pcm_center_lfe (chip,3 )) <0 ) { + err =snd_cs46xx_pcm_center_lfe (chip,3 ); +if (err <0 ) {snd_card_free (card);return err; } }#endif -if ((err =snd_cs46xx_midi (chip,0 )) <0 ) { + err =snd_cs46xx_midi (chip,0 ); +if (err <0 ) {snd_card_free (card);return err; } -if ((err =snd_cs46xx_start_dsp (chip)) <0 ) { + err =snd_cs46xx_start_dsp (chip); +if (err <0 ) {snd_card_free (card);return err; }
@@ -146,7 +154,8 @@ static int snd_card_cs46xx_probe(struct pci_dev *pci, chip->ba1_addr, chip->irq); -if ((err =snd_card_register (card)) <0 ) { + err =snd_card_register (card); +if (err <0 ) {snd_card_free (card);return err; }
sound/pci/cs46xx/cs46xx_lib.c +47 -24
165 lines not on this page · raw message
sound/pci/cs46xx/dsp_spos.c +21 -8
@@ -627,7 +627,9 @@ static void cs46xx_dsp_proc_parameter_dump_read (struct snd_info_entry *entry, col =0 ; } -if ( (symbol =cs46xx_dsp_lookup_symbol_addr (chip,i /sizeof (u32),SYMBOL_PARAMETER )) !=NULL ) { + symbol =cs46xx_dsp_lookup_symbol_addr (chip, i /sizeof (u32), +SYMBOL_PARAMETER ); +if (symbol) { col =0 ;snd_iprintf (buffer,"\n%s:\n" ,symbol->symbol_name); }
@@ -796,7 +798,8 @@ int cs46xx_dsp_proc_init (struct snd_card *card, struct snd_cs46xx *chip) ins->snd_card = card; -if ((entry =snd_info_create_card_entry (card,"dsp" , card->proc_root)) !=NULL ) { + entry =snd_info_create_card_entry (card,"dsp" , card->proc_root); +if (entry) { entry->content =SNDRV_INFO_CONTENT_TEXT ; entry->mode =S_IFDIR |S_IRUGO |S_IXUGO ;
@@ -811,7 +814,9 @@ int cs46xx_dsp_proc_init (struct snd_card *card, struct snd_cs46xx *chip)if (!ins->proc_dsp_dir)return -ENOMEM ; -if ((entry =snd_info_create_card_entry (card,"spos_symbols" , ins->proc_dsp_dir)) !=NULL ) { + entry =snd_info_create_card_entry (card,"spos_symbols" , + ins->proc_dsp_dir); +if (entry) { entry->content =SNDRV_INFO_CONTENT_TEXT ; entry->private_data = chip; entry->mode =S_IFREG |S_IRUGO |S_IWUSR ;
@@ -823,7 +828,9 @@ int cs46xx_dsp_proc_init (struct snd_card *card, struct snd_cs46xx *chip) } ins->proc_sym_info_entry = entry; -if ((entry =snd_info_create_card_entry (card,"spos_modules" , ins->proc_dsp_dir)) !=NULL ) { + entry =snd_info_create_card_entry (card,"spos_modules" , + ins->proc_dsp_dir); +if (entry) { entry->content =SNDRV_INFO_CONTENT_TEXT ; entry->private_data = chip; entry->mode =S_IFREG |S_IRUGO |S_IWUSR ;
@@ -835,7 +842,9 @@ int cs46xx_dsp_proc_init (struct snd_card *card, struct snd_cs46xx *chip) } ins->proc_modules_info_entry = entry; -if ((entry =snd_info_create_card_entry (card,"parameter" , ins->proc_dsp_dir)) !=NULL ) { + entry =snd_info_create_card_entry (card,"parameter" , + ins->proc_dsp_dir); +if (entry) { entry->content =SNDRV_INFO_CONTENT_TEXT ; entry->private_data = chip; entry->mode =S_IFREG |S_IRUGO |S_IWUSR ;
@@ -847,7 +856,8 @@ int cs46xx_dsp_proc_init (struct snd_card *card, struct snd_cs46xx *chip) } ins->proc_parameter_dump_info_entry = entry; -if ((entry =snd_info_create_card_entry (card,"sample" , ins->proc_dsp_dir)) !=NULL ) { + entry =snd_info_create_card_entry (card,"sample" , ins->proc_dsp_dir); +if (entry) { entry->content =SNDRV_INFO_CONTENT_TEXT ; entry->private_data = chip; entry->mode =S_IFREG |S_IRUGO |S_IWUSR ;
@@ -859,7 +869,9 @@ int cs46xx_dsp_proc_init (struct snd_card *card, struct snd_cs46xx *chip) } ins->proc_sample_dump_info_entry = entry; -if ((entry =snd_info_create_card_entry (card,"task_tree" , ins->proc_dsp_dir)) !=NULL ) { + entry =snd_info_create_card_entry (card,"task_tree" , + ins->proc_dsp_dir); +if (entry) { entry->content =SNDRV_INFO_CONTENT_TEXT ; entry->private_data = chip; entry->mode =S_IFREG |S_IRUGO |S_IWUSR ;
@@ -871,7 +883,8 @@ int cs46xx_dsp_proc_init (struct snd_card *card, struct snd_cs46xx *chip) } ins->proc_task_info_entry = entry; -if ((entry =snd_info_create_card_entry (card,"scb_info" , ins->proc_dsp_dir)) !=NULL ) { + entry =snd_info_create_card_entry (card,"scb_info" , ins->proc_dsp_dir); +if (entry) { entry->content =SNDRV_INFO_CONTENT_TEXT ; entry->private_data = chip; entry->mode =S_IFREG |S_IRUGO |S_IWUSR ;
sound/pci/cs46xx/dsp_spos_scb_lib.c +4 -3
@@ -256,9 +256,10 @@ void cs46xx_dsp_proc_register_scb_desc (struct snd_cs46xx *chip,/* register to proc */ if (ins->snd_card !=NULL && ins->proc_dsp_dir !=NULL && scb->proc_info =NULL ) { - -if ((entry =snd_info_create_card_entry (ins->snd_card, scb->scb_name, - ins->proc_dsp_dir)) !=NULL ) { + entry =snd_info_create_card_entry (ins->snd_card, + scb->scb_name, + ins->proc_dsp_dir); +if (entry) { scb_info =kmalloc (sizeof (struct proc_scb_info ),GFP_KERNEL );if (!scb_info) {snd_info_free_entry (entry);
Signature · 1 line
2.15.0
Re: [PATCH 1/4] ALSA: cs46xx: Adjust 33 function calls together with a variable assignment
sound/pci/cs46xx/cs46xx_lib.c static int _cs46xx_adjust_sample_rate (struct snd_cs46xx *chip, struct snd_cs46x · line 1075
Quoted 6 lines · SF Markus Elfring
sound/pci/cs46xx/cs46xx_lib.c +2
-4- -if ( (cpcm->pcm_channel =cs46xx_dsp_create_pcm_channel (chip, sample_rate, cpcm, - cpcm->hw_buf.addr, - cpcm->pcm_channel_id)) =NULL ) { + cpcm + ->pcm_channel = cs46xx_dsp_create_pcm_channel(chip,
^^^^^^^^^^^^^
Please don't break it up like this
sound/pci/cs46xx/cs46xx_lib.c static int _cs46xx_adjust_sample_rate (struct snd_cs46xx *chip, struct snd_cs46x · line 1080
Quoted 5 lines
sound/pci/cs46xx/cs46xx_lib.c +5
-0+ sample_rate, + cpcm, + cpcm->hw_buf.addr, + cpcm + ->pcm_channel_id);
^^^^^^^^^^^^^^^^
or this. It's better to go over 80 characters than to do that.
regards,
dan carpenter
PATCH 2/4 ALSA: cs46xx: Use common error handling code in two functions
In reply to SF Markus ElfringFrom: Markus Elfring <[email protected]>
Date: Mon, 13 Nov 2017 18:53:11 +0100
Add jump targets so that a bit of exception handling can be better reused at the end of these functions.
This issue was detected by using the Coccinelle software.
--- sound/pci/cs46xx/cs46xx.c | 64 ++++++++++++++++++------------------------- sound/pci/cs46xx/cs46xx_lib.c | 44 ++++++++++++++--------------- 2 files changed, 47 insertions(+), 61 deletions(-)
sound/pci/cs46xx/cs46xx.c +27 -37
@@ -95,54 +95,42 @@ static int snd_card_cs46xx_probe(struct pci_dev *pci, err =snd_cs46xx_create (card, pci, external_amp[dev], thinkpad[dev], &chip); -if (err <0 ) { -snd_card_free (card); -return err; - } +if (err <0 ) + goto free_card; + card->private_data = chip; chip->accept_valid = mmap_valid[dev]; err =snd_cs46xx_pcm (chip,0 ); -if (err <0 ) { -snd_card_free (card); -return err; - } +if (err <0 ) + goto free_card; +#ifdef CONFIG_SND_CS46XX_NEW_DSP err =snd_cs46xx_pcm_rear (chip,1 ); -if (err <0 ) { -snd_card_free (card); -return err; - } +if (err <0 ) + goto free_card; + err =snd_cs46xx_pcm_iec958 (chip,2 ); -if (err <0 ) { -snd_card_free (card); -return err; - } +if (err <0 ) + goto free_card;#endif err =snd_cs46xx_mixer (chip,2 ); -if (err <0 ) { -snd_card_free (card); -return err; - } +if (err <0 ) + goto free_card; +#ifdef CONFIG_SND_CS46XX_NEW_DSP if (chip->nr_ac97_codecs =2 ) { err =snd_cs46xx_pcm_center_lfe (chip,3 ); -if (err <0 ) { -snd_card_free (card); -return err; - } +if (err <0 ) + goto free_card; }#endif err =snd_cs46xx_midi (chip,0 ); -if (err <0 ) { -snd_card_free (card); -return err; - } - err =snd_cs46xx_start_dsp (chip); -if (err <0 ) { -snd_card_free (card); -return err; - } +if (err <0 ) + goto free_card; + err =snd_cs46xx_start_dsp (chip); +if (err <0 ) + goto free_card;snd_cs46xx_gameport (chip);
@@ -155,14 +143,16 @@ static int snd_card_cs46xx_probe(struct pci_dev *pci, chip->irq); err =snd_card_register (card); -if (err <0 ) { -snd_card_free (card); -return err; - } +if (err <0 ) + goto free_card;pci_set_drvdata (pci, card); dev++;return 0 ; + +free_card: +snd_card_free (card); +return err; }static void snd_card_cs46xx_remove (struct pci_dev *pci)
sound/pci/cs46xx/cs46xx_lib.c +20 -24
87 lines not on this page · raw message
Signature · 1 line
2.15.0
PATCH 3/4 ALSA: cs46xx: Improve a size determination in cs46xx_dsp_proc_register_scb_desc()
In reply to SF Markus ElfringFrom: Markus Elfring <[email protected]>
Date: Mon, 13 Nov 2017 18:56:58 +0100
Replace the specification of a data structure by a pointer dereference as the parameter for the operator "sizeof" to make the corresponding size determination a bit safer according to the Linux coding style convention.
This issue was detected by using the Coccinelle software.
--- sound/pci/cs46xx/dsp_spos_scb_lib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/pci/cs46xx/dsp_spos_scb_lib.c +1 -1
@@ -260,7 +260,7 @@ void cs46xx_dsp_proc_register_scb_desc (struct snd_cs46xx *chip, scb->scb_name, ins->proc_dsp_dir);if (entry) { - scb_info =kmalloc (sizeof (struct proc_scb_info ),GFP_KERNEL ); + scb_info =kmalloc (sizeof (*scb_info),GFP_KERNEL );if (!scb_info) {snd_info_free_entry (entry); entry =NULL ;
Signature · 1 line
2.15.0
PATCH 4/4 ALSA: cs46xx: Adjust 35 checks for null pointers
In reply to SF Markus ElfringFrom: Markus Elfring <[email protected]>
Date: Mon, 13 Nov 2017 19:03:29 +0100
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The script “checkpatch.pl” pointed information out like the following.
Comparison to NULL could be written …
Thus fix the affected source code places.
--- sound/pci/cs46xx/cs46xx_lib.c | 21 +++++++++++---------- sound/pci/cs46xx/dsp_spos.c | 31 +++++++++++++++---------------- sound/pci/cs46xx/dsp_spos_scb_lib.c | 27 +++++++++++---------------- 3 files changed, 37 insertions(+), 42 deletions(-)
sound/pci/cs46xx/cs46xx_lib.c +11 -10
@@ -1057,10 +1057,10 @@ static int _cs46xx_adjust_sample_rate (struct snd_cs46xx *chip, struct snd_cs46x {/* If PCMReaderSCB and SrcTaskSCB not created yet ... */ -if ( cpcm->pcm_channel =NULL ) { +if (!cpcm->pcm_channel) { cpcm->pcm_channel =cs46xx_dsp_create_pcm_channel (chip, sample_rate, cpcm, cpcm->hw_buf.addr,cpcm->pcm_channel_id); -if (cpcm->pcm_channel =NULL ) { +if (!cpcm->pcm_channel) {dev_err (chip->card->dev,"failed to create virtual PCM channel\n" );return -ENOMEM ;
@@ -1514,7 +1514,7 @@ static int _cs46xx_playback_open_channel (struct snd_pcm_substream *substream,instruct snd_pcm_runtime *runtime = substream->runtime; cpcm =kzalloc (sizeof (*cpcm),GFP_KERNEL ); -if (cpcm =NULL ) +if (!cpcm)return -ENOMEM ;if (snd_dma_alloc_pages (SNDRV_DMA_TYPE_DEV ,snd_dma_pci_data (chip->pci),PAGE_SIZE , &cpcm->hw_buf) <0 ) {
@@ -2063,7 +2063,7 @@ static int snd_cs46xx_adc_capture_get(struct snd_kcontrol *kcontrol,struct snd_cs46xx *chip =snd_kcontrol_chip (kcontrol);struct dsp_spos_instance * ins = chip->dsp_spos_instance; -if (ins->adc_input !=NULL ) +if (ins->adc_input) ucontrol->value.integer.value[0 ] =1 ;else ucontrol->value.integer.value[0 ] =0 ;
@@ -2094,7 +2094,7 @@ static int snd_cs46xx_pcm_capture_get(struct snd_kcontrol *kcontrol,struct snd_cs46xx *chip =snd_kcontrol_chip (kcontrol);struct dsp_spos_instance * ins = chip->dsp_spos_instance; -if (ins->pcm_input !=NULL ) +if (ins->pcm_input) ucontrol->value.integer.value[0 ] =1 ;else ucontrol->value.integer.value[0 ] =0 ;
@@ -3643,7 +3643,7 @@ static void clkrun_init(struct snd_cs46xx *chip) pdev =pci_get_device (PCI_VENDOR_ID_INTEL ,PCI_DEVICE_ID_INTEL_82371AB_3 ,NULL ); -if (pdev =NULL ) +if (!pdev)return ;/* Not a thinkpad thats for sure */ /* Find the control port */
@@ -3919,7 +3919,7 @@ int snd_cs46xx_create(struct snd_card *card,return err; chip =kzalloc (sizeof (*chip),GFP_KERNEL ); -if (chip =NULL ) { +if (!chip) {pci_disable_device (pci);return -ENOMEM ; }
@@ -3997,9 +3997,10 @@ int snd_cs46xx_create(struct snd_card *card,clkrun_init (chip); } -if (chip->amplifier_ctrl =NULL ) +if (!chip->amplifier_ctrl) chip->amplifier_ctrl = amp_none; -if (chip->active_ctrl =NULL ) + +if (!chip->active_ctrl) chip->active_ctrl = amp_none; chip->active_ctrl (chip,1 );/* enable CLKRUN */
@@ -4019,7 +4020,7 @@ int snd_cs46xx_create(struct snd_card *card, goto free_sound_chip; } region->remap_addr =ioremap_nocache (region->base, region->size); -if (region->remap_addr =NULL ) { +if (!region->remap_addr) {dev_err (chip->card->dev,"%s ioremap problem\n" , region->name); goto e_nomem;
sound/pci/cs46xx/dsp_spos.c +15 -16
@@ -236,7 +236,7 @@ struct dsp_spos_instance *cs46xx_dsp_spos_create (struct snd_cs46xx * chip) {struct dsp_spos_instance * ins =kzalloc (sizeof (struct dsp_spos_instance ),GFP_KERNEL ); -if (ins =NULL ) +if (!ins)return NULL ;/* better to use vmalloc for this big table */
@@ -402,7 +402,7 @@ int cs46xx_dsp_load_module (struct snd_cs46xx * chip, struct dsp_module_desc * msnd_cs46xx_clear_BA1 (chip,DSP_CODE_BYTE_OFFSET ,DSP_CODE_BYTE_SIZE ); } -if (code =NULL ) { +if (!code) {dev_dbg (chip->card->dev,"dsp_spos: module got no code segment\n" ); }else {
@@ -514,10 +514,8 @@ static void cs46xx_dsp_proc_symbol_table_read (struct snd_info_entry *entry,if (ins->symbol_table.symbols[i].deleted)continue ; -if (ins->symbol_table.symbols[i].module !=NULL ) { +if (ins->symbol_table.symbols[i].module) module_str = ins->symbol_table.symbols[i].module->module_name; - } - snd_iprintf(buffer, "%04X <%02X> %s [%s]\n", ins->symbol_table.symbols[i].address,
@@ -593,11 +591,12 @@ static void cs46xx_dsp_proc_scb_read (struct snd_info_entry *entry,continue ;snd_iprintf (buffer,"\n%04x %s:\n\n" ,ins->scbs[i].address,ins->scbs[i].scb_name); -if (ins->scbs[i].parent_scb_ptr !=NULL ) { +if (ins->scbs[i].parent_scb_ptr)snd_iprintf (buffer,"parent [%s:%04x] " , ins->scbs[i].parent_scb_ptr->scb_name, ins->scbs[i].parent_scb_ptr->address); - }else snd_iprintf (buffer,"parent [none] " ); +else +snd_iprintf (buffer,"parent [none] " ); snd_iprintf(buffer,"sub_list_ptr [%s:%04x]\nnext_scb_ptr [%s:%04x] task_entry [%s:%04x]\n", ins->scbs[i].sub_list_ptr->scb_name,
@@ -1141,35 +1140,35 @@ int cs46xx_dsp_scb_and_task_init (struct snd_cs46xx *chip)cs46xx_dsp_create_task_tree (chip,"sposCB" , (u32 *)&sposcb,SPOSCB_ADDR ,0x10 ); null_algorithm =cs46xx_dsp_lookup_symbol (chip,"NULLALGORITHM" ,SYMBOL_CODE ); -if (null_algorithm =NULL ) { +if (!null_algorithm) {dev_err (chip->card->dev,"dsp_spos: symbol NULLALGORITHM not found\n" );return -EIO ; } fg_task_tree_header_code =cs46xx_dsp_lookup_symbol (chip,"FGTASKTREEHEADERCODE" ,SYMBOL_CODE ); -if (fg_task_tree_header_code =NULL ) { +if (!fg_task_tree_header_code) {dev_err (chip->card->dev,"dsp_spos: symbol FGTASKTREEHEADERCODE not found\n" );return -EIO ; } task_tree_header_code =cs46xx_dsp_lookup_symbol (chip,"TASKTREEHEADERCODE" ,SYMBOL_CODE ); -if (task_tree_header_code =NULL ) { +if (!task_tree_header_code) {dev_err (chip->card->dev,"dsp_spos: symbol TASKTREEHEADERCODE not found\n" );return -EIO ; } task_tree_thread =cs46xx_dsp_lookup_symbol (chip,"TASKTREETHREAD" ,SYMBOL_CODE ); -if (task_tree_thread =NULL ) { +if (!task_tree_thread) {dev_err (chip->card->dev,"dsp_spos: symbol TASKTREETHREAD not found\n" );return -EIO ; } magic_snoop_task =cs46xx_dsp_lookup_symbol (chip,"MAGICSNOOPTASK" ,SYMBOL_CODE ); -if (magic_snoop_task =NULL ) { +if (!magic_snoop_task) {dev_err (chip->card->dev,"dsp_spos: symbol MAGICSNOOPTASK not found\n" );return -EIO ;
@@ -1532,20 +1531,20 @@ static int cs46xx_dsp_async_init (struct snd_cs46xx *chip,struct dsp_scb_descriptor * spdifi_scb_desc, * spdifo_scb_desc, * async_codec_scb_desc; s16_async_codec_input_task =cs46xx_dsp_lookup_symbol (chip,"S16_ASYNCCODECINPUTTASK" ,SYMBOL_CODE ); -if (s16_async_codec_input_task =NULL ) { +if (!s16_async_codec_input_task) {dev_err (chip->card->dev,"dsp_spos: symbol S16_ASYNCCODECINPUTTASK not found\n" );return -EIO ; } spdifo_task =cs46xx_dsp_lookup_symbol (chip,"SPDIFOTASK" ,SYMBOL_CODE ); -if (spdifo_task =NULL ) { +if (!spdifo_task) {dev_err (chip->card->dev,"dsp_spos: symbol SPDIFOTASK not found\n" );return -EIO ; } spdifi_task =cs46xx_dsp_lookup_symbol (chip,"SPDIFITASK" ,SYMBOL_CODE ); -if (spdifi_task =NULL ) { +if (!spdifi_task) {dev_err (chip->card->dev,"dsp_spos: symbol SPDIFITASK not found\n" );return -EIO ;
@@ -1971,7 +1970,7 @@ int cs46xx_dsp_set_iec958_volume (struct snd_cs46xx * chip, u16 left, u16 right)mutex_lock (&chip->spos_mutex); -if (ins->asynch_rx_scb !=NULL ) +if (ins->asynch_rx_scb)cs46xx_dsp_scb_set_volume (chip,ins->asynch_rx_scb, left,right);
sound/pci/cs46xx/dsp_spos_scb_lib.c +11 -16
@@ -93,7 +93,7 @@ static void cs46xx_dsp_proc_scb_info_read (struct snd_info_entry *entry,snd_iprintf (buffer,"\n" ); -if (scb->parent_scb_ptr !=NULL ) { +if (scb->parent_scb_ptr) {snd_iprintf (buffer,"parent [%s:%04x] " , scb->parent_scb_ptr->scb_name, scb->parent_scb_ptr->address);
@@ -254,8 +254,7 @@ void cs46xx_dsp_proc_register_scb_desc (struct snd_cs46xx *chip,struct proc_scb_info * scb_info;/* register to proc */ -if (ins->snd_card !=NULL && ins->proc_dsp_dir !=NULL && - scb->proc_info =NULL ) { +if (ins->snd_card && ins->proc_dsp_dir && !scb->proc_info) { entry =snd_info_create_card_entry (ins->snd_card, scb->scb_name, ins->proc_dsp_dir);
@@ -376,8 +375,7 @@ cs46xx_dsp_create_generic_scb (struct snd_cs46xx *chip, char * name, u32 * scb_d task_entry =cs46xx_dsp_lookup_symbol (chip,task_entry_name,SYMBOL_CODE ); - -if (task_entry =NULL ) { +if (!task_entry) {dev_err (chip->card->dev,"dsp_spos: symbol %s not found\n" , task_entry_name);return NULL ;
@@ -588,11 +586,10 @@ cs46xx_dsp_create_pcm_reader_scb(struct snd_cs46xx * chip, char * scb_name, } }; -if (ins->null_algorithm =NULL ) { +if (!ins->null_algorithm) { ins->null_algorithm =cs46xx_dsp_lookup_symbol (chip,"NULLALGORITHM" ,SYMBOL_CODE ); - -if (ins->null_algorithm =NULL ) { +if (!ins->null_algorithm) {dev_err (chip->card->dev,"dsp_spos: symbol NULLALGORITHM not found\n" );return NULL ;
@@ -678,11 +675,10 @@ cs46xx_dsp_create_src_task_scb(struct snd_cs46xx * chip, char * scb_name, } }; -if (ins->s16_up =NULL ) { +if (!ins->s16_up) { ins->s16_up =cs46xx_dsp_lookup_symbol (chip,"S16_UPSRC" ,SYMBOL_CODE ); - -if (ins->s16_up =NULL ) { +if (!ins->s16_up) {dev_err (chip->card->dev,"dsp_spos: symbol S16_UPSRC not found\n" );return NULL ;
@@ -1292,9 +1288,8 @@ cs46xx_dsp_create_pcm_channel (struct snd_cs46xx * chip,if (!sample_rate) sample_rate =44100 ;/* search for a already created SRC SCB with the same sample rate */ -for (i =0 ; i <DSP_MAX_PCM_CHANNELS && - (pcm_index =-1 || src_scb =NULL ); ++i) { - +for (i =0 ; i <DSP_MAX_PCM_CHANNELS && (pcm_index =-1 || !src_scb); + ++i) {/* virtual channel reserved for capture */ if (i =CS46XX_DSP_CAPTURE_CHANNEL )continue ;
@@ -1317,7 +1312,7 @@ cs46xx_dsp_create_pcm_channel (struct snd_cs46xx * chip,return NULL ; } -if (src_scb =NULL ) { +if (!src_scb) {if (ins->nsrc_scb >=DSP_MAX_SRC_NR ) {dev_err (chip->card->dev,"dsp_spos: to many SRC instances\n!" );
@@ -1784,7 +1779,7 @@ int cs46xx_iec958_post_close (struct snd_cs46xx *chip)cs46xx_poke_via_dsp (chip,SP_SPDOUT_CSUV , ins->spdif_csuv_default);/* deallocate stuff */ -if (ins->spdif_pcm_input_scb !=NULL ) { +if (ins->spdif_pcm_input_scb) {cs46xx_dsp_remove_scb (chip,ins->spdif_pcm_input_scb); ins->spdif_pcm_input_scb =NULL ; }
Signature · 1 line
2.15.0