ALSA: cleanups for sparse/cppcheck warnings
Subsystems (4)
cover ALSA: cleanups for sparse/cppcheck warnings
Various cleanups for ALSA core, compressed, hda, usb, ac97 and Digigram cards.
Pierre-Louis Bossart (18):
ALSA: core: pcm: simplify locking for timers
ALSA: core: memalloc: fix fallthrough position
ALSA: core: pcm_memory: dereference pointer after NULL checks
ALSA: core: timer: remove redundant assignment
ALSA: core: timer: clarify operator precedence
ALSA: compress_offload: dereference after checking for NULL pointer
ALSA: compress_offload: remove redundant initialization
ALSA: core: init: use DECLARE_COMPLETION_ONSTACK() macro
ALSA: aoa: i2sbus: use DECLARE_COMPLETION_ONSTACK() macro
ALSA: hda: auto_parser: remove shadowed variable declaration
ALSA: hda: (cosmetic) align function parameters
ALSA: usb: scarless_gen2: fix endianness issue
ALSA: ac97: (cosmetic) align argument names
ALSA: atmel: ac97: clarify operator precedence
ALSA: rawmidi: (cosmetic) align function parameters
ALSA: vx: vx_core: clarify operator precedence
ALSA: vx: vx_pcm: remove redundant assignment
ALSA: vx: vx_pcm: remove redundant assignment
sound/ac97/ac97_core.h | 2 +- sound/aoa/soundbus/i2sbus/pcm.c | 3 +-- sound/atmel/ac97c.c | 22 +++++++++++----------- sound/core/compress_offload.c | 5 +++-- sound/core/init.c | 3 +-- sound/core/memalloc.c | 2 +- sound/core/pcm.c | 8 +++++--- sound/core/pcm_memory.c | 3 ++- sound/core/rawmidi.c | 2 +- sound/core/timer.c | 6 +++--- sound/drivers/vx/vx_core.c | 4 ++-- sound/drivers/vx/vx_pcm.c | 2 -- sound/pci/hda/hda_auto_parser.c | 2 +- sound/pci/hda/hda_jack.h | 2 +- sound/pci/hda/hda_local.h | 8 ++++---- sound/usb/mixer_scarlett_gen2.c | 2 +- 16 files changed, 38 insertions(+), 38 deletions(-)
Signature · 1 line
2.25.1
PATCH 1/18 ALSA: core: pcm: simplify locking for timers
Fix sparse warning:
sound/core/pcm.c:999:9: warning: context imbalance in 'snd_pcm_detach_substream' - different lock contexts for basic block
There's no real reason to test the same thing twice, and it's simpler have linear sequences.
--- sound/core/pcm.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
sound/core/pcm.c +5 -3
@@ -991,11 +991,13 @@ void snd_pcm_detach_substream(struct snd_pcm_substream *substream) PAGE_ALIGN(sizeof(struct snd_pcm_mmap_control)));kfree (runtime->hw_constraints.rules);/* Avoid concurrent access to runtime via PCM timer interface */ -if (substream->timer) +if (substream->timer) {spin_lock_irq (&substream->timer->lock); - substream->runtime =NULL ; -if (substream->timer) + substream->runtime =NULL ;spin_unlock_irq (&substream->timer->lock); + }else { + substream->runtime =NULL ; + }kfree (runtime);put_pid (substream->pid); substream->pid =NULL ;
Signature · 1 line
2.25.1
PATCH 2/18 ALSA: core: memalloc: fix fallthrough position
In reply to Pierre-Louis BossartFix cppcheck, the fallthrough only makes sense within the conditional block
sound/core/memalloc.c:161:3: style:inconclusive: Statements following return, break, continue, goto or throw will never be executed. [unreachableCode]
fallthrough;
^
--- sound/core/memalloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/core/memalloc.c +1 -1
@@ -157,8 +157,8 @@ int snd_dma_alloc_pages(int type, struct device *device, size_t size,* so if we fail to malloc, try to fetch memory traditionally. */ dmab->dev.type =SNDRV_DMA_TYPE_DEV ; -#endif /* CONFIG_GENERIC_ALLOCATOR */ fallthrough; +#endif /* CONFIG_GENERIC_ALLOCATOR */ case SNDRV_DMA_TYPE_DEV :case SNDRV_DMA_TYPE_DEV_UC :snd_malloc_dev_pages (dmab, size);
Signature · 1 line
2.25.1
PATCH 3/18 ALSA: core: pcm_memory: dereference pointer after NULL checks
In reply to Pierre-Louis BossartFix cppcheck warnings:
sound/core/pcm_memory.c:380:26: warning: Either the condition '!substream' is redundant or there is possible null pointer
dereference: substream. [nullPointerRedundantCheck]
struct snd_card *card = substream->pcm->card;
^
sound/core/pcm_memory.c:384:6: note: Assuming that condition
'!substream' is not redundant
if (PCM_RUNTIME_CHECK(substream))
^
sound/core/pcm_memory.c:380:26: note: Null pointer dereference
struct snd_card *card = substream->pcm->card;
^
sound/core/pcm_memory.c:433:26: warning: Either the condition
'!substream' is redundant or there is possible null pointer
dereference: substream. [nullPointerRedundantCheck]
struct snd_card *card = substream->pcm->card;
^
sound/core/pcm_memory.c:436:6: note: Assuming that condition
'!substream' is not redundant
if (PCM_RUNTIME_CHECK(substream))
^
sound/core/pcm_memory.c:433:26: note: Null pointer dereference
struct snd_card *card = substream->pcm->card;
^--- sound/core/pcm_memory.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
sound/core/pcm_memory.c +2 -1
@@ -377,7 +377,7 @@ struct page *snd_pcm_sgbuf_ops_page(struct snd_pcm_substream *substream, unsigne*/ int snd_pcm_lib_malloc_pages (struct snd_pcm_substream *substream,size_t size) { -struct snd_card *card = substream->pcm->card; +struct snd_card *card;struct snd_pcm_runtime *runtime;struct snd_dma_buffer *dmab =NULL ;
@@ -387,6 +387,7 @@ int snd_pcm_lib_malloc_pages(struct snd_pcm_substream *substream, size_t size) SNDRV_DMA_TYPE_UNKNOWN))return -EINVAL ; runtime = substream->runtime; + card = substream->pcm->card;if (runtime->dma_buffer_p) {/* perphaps, we might free the large DMA memory region
Signature · 1 line
2.25.1
PATCH 4/18 ALSA: core: timer: remove redundant assignment
In reply to Pierre-Louis BossartCppcheck complains about a possible NULL pointer dereference but it actually looks like the NULL assignment is not needed (same loop is used in other parts of the file without it).
--- sound/core/timer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/core/timer.c +1 -1
@@ -173,7 +173,7 @@ EXPORT_SYMBOL(snd_timer_instance_free);*/ static struct snd_timer *snd_timer_find (struct snd_timer_id *tid) { -struct snd_timer *timer =NULL ; +struct snd_timer *timer;list_for_each_entry (timer, &snd_timer_list, device_list) {if (timer->tmr_class != tid->dev_class)
Signature · 1 line
2.25.1
PATCH 5/18 ALSA: core: timer: clarify operator precedence
In reply to Pierre-Louis Bossartfix cppcheck warning:
sound/core/timer.c:1286:9: style: Clarify calculation precedence for '&' and '?'. [clarifyCalculation]
? "running" : "stopped");
^--- sound/core/timer.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/core/timer.c +2 -2
@@ -1280,8 +1280,8 @@ static void snd_timer_proc_read(struct snd_info_entry *entry,list_for_each_entry (ti, &timer->open_list_head, open_list)snd_iprintf (buffer," Client %s : %s\n" , ti->owner ? ti->owner :"unknown" , - ti->flags & (SNDRV_TIMER_IFLG_START | -SNDRV_TIMER_IFLG_RUNNING ) + (ti->flags & (SNDRV_TIMER_IFLG_START | +SNDRV_TIMER_IFLG_RUNNING )) ?"running" :"stopped" ); }mutex_unlock (®ister_mutex);
Signature · 1 line
2.25.1
PATCH 6/18 ALSA: compress_offload: dereference after checking for NULL pointer
In reply to Pierre-Louis BossartFix cppcheck warning and only dereference once the initial checks are done:
sound/core/compress_offload.c:516:38: warning: Either the condition '!stream' is redundant or there is possible null pointer dereference:
stream. [nullPointerRedundantCheck]
struct snd_compr_runtime *runtime = stream->runtime;
^
sound/core/compress_offload.c:518:17: note: Assuming that condition
'!stream' is not redundant
if (snd_BUG_ON(!(stream) || !(stream)->runtime))
^
sound/core/compress_offload.c:516:38: note: Null pointer dereference
struct snd_compr_runtime *runtime = stream->runtime;
^--- sound/core/compress_offload.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
sound/core/compress_offload.c +2 -1
@@ -513,10 +513,11 @@ EXPORT_SYMBOL(snd_compr_malloc_pages);int snd_compr_free_pages (struct snd_compr_stream *stream) { -struct snd_compr_runtime *runtime = stream->runtime; +struct snd_compr_runtime *runtime;if (snd_BUG_ON (!(stream) || !(stream)->runtime))return -EINVAL ; + runtime = stream->runtime;if (runtime->dma_area ==NULL )return 0 ;if (runtime->dma_buffer_p != &stream->dma_buffer) {
Signature · 1 line
2.25.1
Re: [PATCH 06/18] ALSA: compress_offload: dereference after checking for NULL pointer
Quoted 6 lines · Pierre-Louis Bossart
Fix cppcheck warning and only dereference once the initial checks are done:
sound/core/compress_offload.c:516:38: warning: Either the condition '!stream' is redundant or there is possible null pointer dereference:
stream. [nullPointerRedundantCheck]
Quoted 9 lines
struct snd_compr_runtime *runtime = stream->runtime;
^
sound/core/compress_offload.c:518:17: note: Assuming that condition
'!stream' is not redundant
if (snd_BUG_ON(!(stream) || !(stream)->runtime))
^
sound/core/compress_offload.c:516:38: note: Null pointer dereference
struct snd_compr_runtime *runtime = stream->runtime;
^Quoted 25 lines
Signed-off-by Pierre-Louis Bossart <[email protected]>--- sound/core/compress_offload.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)sound/core/compress_offload.c +2
-1@@ -513,10 +513,11 @@ EXPORT_SYMBOL(snd_compr_malloc_pages);int snd_compr_free_pages (struct snd_compr_stream *stream) { -struct snd_compr_runtime *runtime = stream->runtime; +struct snd_compr_runtime *runtime;if (snd_BUG_ON (!(stream) || !(stream)->runtime))return -EINVAL ; + runtime = stream->runtime;if (runtime->dma_area ==NULL )return 0 ;if (runtime->dma_buffer_p != &stream->dma_buffer) {Signature · 1 line
2.25.1
Signature · 1 line
~Vinod
PATCH 7/18 ALSA: compress_offload: remove redundant initialization
In reply to Pierre-Louis BossartFix cppcheck warning:
sound/core/compress_offload.c:1044:6: style: Redundant initialization for 'ret'. The initialized value is overwritten before it is read. [redundantInitialization]
ret = snd_register_device(SNDRV_DEVICE_TYPE_COMPRESS,
^
sound/core/compress_offload.c:1034:10: note: ret is initialized
int ret = -EINVAL;
^
sound/core/compress_offload.c:1044:6: note: ret is overwritten
ret = snd_register_device(SNDRV_DEVICE_TYPE_COMPRESS,
^--- sound/core/compress_offload.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/core/compress_offload.c +1 -1
@@ -1032,7 +1032,7 @@ static const struct file_operations snd_compr_file_ops = {static int snd_compress_dev_register (struct snd_device *device) { -int ret = -EINVAL ; +int ret;struct snd_compr *compr;if (snd_BUG_ON (!device || !device->device_data))
Signature · 1 line
2.25.1
Re: [PATCH 07/18] ALSA: compress_offload: remove redundant initialization
Quoted 6 lines · Pierre-Louis Bossart
Fix cppcheck warning:
sound/core/compress_offload.c:1044:6: style: Redundant initialization for 'ret'. The initialized value is overwritten before it is read. [redundantInitialization]
Quoted 9 lines
ret = snd_register_device(SNDRV_DEVICE_TYPE_COMPRESS,
^ sound/core/compress_offload.c:1034:10: note: ret is initialized int ret = -EINVAL; ^ sound/core/compress_offload.c:1044:6: note: ret is overwritten ret = snd_register_device(SNDRV_DEVICE_TYPE_COMPRESS, ^
Quoted 20 lines
Signed-off-by Pierre-Louis Bossart <[email protected]>--- sound/core/compress_offload.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)sound/core/compress_offload.c +1
-1@@ -1032,7 +1032,7 @@ static const struct file_operations snd_compr_file_ops = {static int snd_compress_dev_register (struct snd_device *device) { -int ret = -EINVAL ; +int ret;struct snd_compr *compr;if (snd_BUG_ON (!device || !device->device_data))Signature · 1 line
2.25.1
Signature · 1 line
~Vinod
PATCH 8/18 ALSA: core: init: use DECLARE_COMPLETION_ONSTACK() macro
In reply to Pierre-Louis BossartFollow recommendation in Documentation/scheduler/completion.rst and use macro to declare local 'struct completion'
--- sound/core/init.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
sound/core/init.c +1 -2
@@ -519,10 +519,9 @@ EXPORT_SYMBOL(snd_card_free_when_closed);*/ int snd_card_free (struct snd_card *card) { -struct completion released; +DECLARE_COMPLETION_ONSTACK (released);int ret; -init_completion (&released); card->release_completion = &released; ret =snd_card_free_when_closed (card);if (ret)
Signature · 1 line
2.25.1
PATCH 9/18 ALSA: aoa: i2sbus: use DECLARE_COMPLETION_ONSTACK() macro
In reply to Pierre-Louis BossartFollow recommendation in Documentation/scheduler/completion.rst and use macro to declare local 'struct completion'
--- sound/aoa/soundbus/i2sbus/pcm.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
sound/aoa/soundbus/i2sbus/pcm.c +1 -2
@@ -254,12 +254,11 @@ static void i2sbus_wait_for_stop(struct i2sbus_dev *i2sdev, struct pcm_info *pi) {unsigned long flags; -struct completion done; +DECLARE_COMPLETION_ONSTACK (done);long timeout;spin_lock_irqsave (&i2sdev->low_lock, flags);if (pi->dbdma_ring.stopping) { -init_completion (&done); pi->stop_completion = &done;spin_unlock_irqrestore (&i2sdev->low_lock, flags); timeout =wait_for_completion_timeout (&done,HZ );
Signature · 1 line
2.25.1
PATCH 10/18 ALSA: hda: auto_parser: remove shadowed variable declaration
In reply to Pierre-Louis BossartFix cppcheck warning:
sound/pci/hda/hda_auto_parser.c:353:7: style: Local variable 'i' shadows outer variable [shadowVariable]
int i = 0;
^
sound/pci/hda/hda_auto_parser.c:182:6: note: Shadowed declaration
int i;
^
sound/pci/hda/hda_auto_parser.c:353:7: note: Shadow variable
int i = 0;
^It's not clear why a new declaration was added, remove and reuse variable declared with larger scope.
--- sound/pci/hda/hda_auto_parser.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/pci/hda/hda_auto_parser.c +1 -1
@@ -350,7 +350,7 @@ int snd_hda_parse_pin_defcfg(struct hda_codec *codec,*/ if (!cfg->line_outs && cfg->hp_outs >1 && !(cond_flags &HDA_PINCFG_NO_HP_FIXUP )) { -int i =0 ; + i =0 ;while (i < cfg->hp_outs) {/* The real HPs should have the sequence 0x0f */ if ((hp_out[i].seq &0x0f ) ==0x0f ) {
Signature · 1 line
2.25.1
PATCH 11/18 ALSA: hda: (cosmetic) align function parameters
In reply to Pierre-Louis BossartFix cppcheck warnings and use same names in headers and C code.
--- sound/pci/hda/hda_jack.h | 2 +- sound/pci/hda/hda_local.h | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-)
sound/pci/hda/hda_jack.h +1 -1
@@ -77,7 +77,7 @@ int snd_hda_jack_detect_enable(struct hda_codec *codec, hda_nid_t nid,struct hda_jack_callback *snd_hda_jack_detect_enable_callback_mst (struct hda_codec *codec,hda_nid_t nid, -int dev_id,hda_jack_callback_fn cb); +int dev_id,hda_jack_callback_fn func);/** * snd_hda_jack_detect_enable - enable the jack-detection
sound/pci/hda/hda_local.h +4 -4
@@ -100,7 +100,7 @@ int snd_hda_mixer_amp_volume_get(struct snd_kcontrol *kcontrol,int snd_hda_mixer_amp_volume_put (struct snd_kcontrol *kcontrol,struct snd_ctl_elem_value *ucontrol);int snd_hda_mixer_amp_tlv (struct snd_kcontrol *kcontrol,int op_flag, -unsigned int size,unsigned int __user *tlv); +unsigned int size,unsigned int __user *_tlv);int snd_hda_mixer_amp_switch_info (struct snd_kcontrol *kcontrol,struct snd_ctl_elem_info *uinfo); int snd_hda_mixer_amp_switch_get(struct snd_kcontrol *kcontrol,
@@ -119,7 +119,7 @@ int snd_hda_mixer_amp_switch_put_beep(struct snd_kcontrol *kcontrol,int snd_hda_codec_amp_update (struct hda_codec *codec,hda_nid_t nid,int ch,int dir,int idx,int mask,int val);int snd_hda_codec_amp_stereo (struct hda_codec *codec,hda_nid_t nid, -int dir,int idx,int mask,int val); +int direction,int idx,int mask,int val);int snd_hda_codec_amp_init (struct hda_codec *codec,hda_nid_t nid,int ch,int direction,int idx,int mask,int val); int snd_hda_codec_amp_init_stereo(struct hda_codec *codec, hda_nid_t nid,
@@ -198,7 +198,7 @@ int snd_hda_input_mux_put(struct hda_codec *codec, unsigned int *cur_val);int snd_hda_add_imux_item (struct hda_codec *codec,struct hda_input_mux *imux,const char *label, -int index,int *type_index_ret); +int index,int *type_idx);/* * Multi-channel / digital-out PCM helper
@@ -642,7 +642,7 @@ unsigned int snd_hda_codec_eapd_power_filter(struct hda_codec *codec,*/ int snd_hda_enum_helper_info (struct snd_kcontrol *kcontrol,struct snd_ctl_elem_info *uinfo, -int num_entries,const char *const *texts); +int num_items,const char *const *texts);#define snd_hda_enum_bool_helper_info (kcontrol, uinfo) \ snd_hda_enum_helper_info(kcontrol, uinfo, 0, NULL)
Signature · 1 line
2.25.1
PATCH 12/18 ALSA: usb: scarless_gen2: fix endianness issue
In reply to Pierre-Louis BossartFix Sparse warning:
sound/usb/mixer_scarlett_gen2.c:1949:24: warning: cast to restricted __le32
--- sound/usb/mixer_scarlett_gen2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/usb/mixer_scarlett_gen2.c +1 -1
@@ -1946,7 +1946,7 @@ static void scarlett2_mixer_interrupt(struct urb *urb) goto requeue;if (len ==8 ) { - data =le32_to_cpu (*(u32 *)urb->transfer_buffer); + data =le32_to_cpu (*(__le32 *)urb->transfer_buffer);if (data &SCARLETT2_USB_INTERRUPT_VOL_CHANGE )scarlett2_mixer_interrupt_vol_change (mixer);if (data &SCARLETT2_USB_INTERRUPT_BUTTON_CHANGE )
Signature · 1 line
2.25.1
PATCH 13/18 ALSA: ac97: (cosmetic) align argument names
In reply to Pierre-Louis BossartFix cppcheck warning:
sound/ac97/bus.c:133:60: style:inconclusive: Function 'snd_ac97_bus_scan_one' argument 1 names different: declaration 'ac97' definition 'adrv'. [funcArgNamesDifferent]
--- sound/ac97/ac97_core.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/ac97/ac97_core.h +1 -1
@@ -3,7 +3,7 @@* Copyright (C) 2016 Robert Jarzmik <[email protected]> */ -unsigned int snd_ac97_bus_scan_one (struct ac97_controller *ac97, +unsigned int snd_ac97_bus_scan_one (struct ac97_controller *adrv,unsigned int codec_num); static inline bool ac97_ids_match(unsigned int id1, unsigned int id2,
Signature · 1 line
2.25.1
PATCH 14/18 ALSA: atmel: ac97: clarify operator precedence
In reply to Pierre-Louis BossartFix cppcheck warnings:
sound/atmel/ac97c.c:478:30: style: Clarify calculation precedence for '&' and '?'. [clarifyCalculation]
casr & AC97C_CSR_OVRUN ? " OVRUN" : "",
^
sound/atmel/ac97c.c:479:30: style: Clarify calculation precedence for
'&' and '?'. [clarifyCalculation]
casr & AC97C_CSR_RXRDY ? " RXRDY" : "",
^
sound/atmel/ac97c.c:480:30: style: Clarify calculation precedence for
'&' and '?'. [clarifyCalculation]
casr & AC97C_CSR_UNRUN ? " UNRUN" : "",
^
sound/atmel/ac97c.c:481:30: style: Clarify calculation precedence for
'&' and '?'. [clarifyCalculation]
casr & AC97C_CSR_TXEMPTY ? " TXEMPTY" : "",
^
sound/atmel/ac97c.c:482:30: style: Clarify calculation precedence for
'&' and '?'. [clarifyCalculation]
casr & AC97C_CSR_TXRDY ? " TXRDY" : "",
^
sound/atmel/ac97c.c:524:30: style: Clarify calculation precedence for
'&' and '?'. [clarifyCalculation]
cosr & AC97C_CSR_OVRUN ? " OVRUN" : "",
^
sound/atmel/ac97c.c:525:30: style: Clarify calculation precedence for
'&' and '?'. [clarifyCalculation]
cosr & AC97C_CSR_RXRDY ? " RXRDY" : "",
^
sound/atmel/ac97c.c:526:30: style: Clarify calculation precedence for
'&' and '?'. [clarifyCalculation]
cosr & AC97C_CSR_TXEMPTY ? " TXEMPTY" : "",
^
sound/atmel/ac97c.c:527:30: style: Clarify calculation precedence for
'&' and '?'. [clarifyCalculation]
cosr & AC97C_CSR_TXRDY ? " TXRDY" : "",
^--- sound/atmel/ac97c.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-)
sound/atmel/ac97c.c +11 -11
@@ -475,12 +475,12 @@ static irqreturn_t atmel_ac97c_interrupt(int irq, void *dev)struct snd_pcm_runtime *runtime;int offset, next_period, block_size;dev_dbg (&chip->pdev->dev,"channel A event%s%s%s%s%s%s\n" , - casr &AC97C_CSR_OVRUN ?" OVRUN" :"" , - casr &AC97C_CSR_RXRDY ?" RXRDY" :"" , - casr &AC97C_CSR_UNRUN ?" UNRUN" :"" , - casr &AC97C_CSR_TXEMPTY ?" TXEMPTY" :"" , - casr &AC97C_CSR_TXRDY ?" TXRDY" :"" , - !casr ?" NONE" :"" ); + (casr &AC97C_CSR_OVRUN ) ?" OVRUN" :"" , + (casr &AC97C_CSR_RXRDY ) ?" RXRDY" :"" , + (casr &AC97C_CSR_UNRUN ) ?" UNRUN" :"" , + (casr &AC97C_CSR_TXEMPTY ) ?" TXEMPTY" :"" , + (casr &AC97C_CSR_TXRDY ) ?" TXRDY" :"" , + !casr ?" NONE" :"" );if ((casr & camr) &AC97C_CSR_ENDTX ) { runtime = chip->playback_substream->runtime; block_size =frames_to_bytes (runtime, runtime->period_size);
@@ -521,11 +521,11 @@ static irqreturn_t atmel_ac97c_interrupt(int irq, void *dev)if (sr &AC97C_SR_COEVT ) {dev_info (&chip->pdev->dev,"codec channel event%s%s%s%s%s\n" , - cosr &AC97C_CSR_OVRUN ?" OVRUN" :"" , - cosr &AC97C_CSR_RXRDY ?" RXRDY" :"" , - cosr &AC97C_CSR_TXEMPTY ?" TXEMPTY" :"" , - cosr &AC97C_CSR_TXRDY ?" TXRDY" :"" , - !cosr ?" NONE" :"" ); + (cosr &AC97C_CSR_OVRUN ) ?" OVRUN" :"" , + (cosr &AC97C_CSR_RXRDY ) ?" RXRDY" :"" , + (cosr &AC97C_CSR_TXEMPTY ) ?" TXEMPTY" :"" , + (cosr &AC97C_CSR_TXRDY ) ?" TXRDY" :"" , + !cosr ?" NONE" :"" ); retval =IRQ_HANDLED ; }
Signature · 1 line
2.25.1
PATCH 15/18 ALSA: rawmidi: (cosmetic) align function parameters
In reply to Pierre-Louis Bossartfix cppcheck:
sound/core/rawmidi.c:1711:49: style:inconclusive: Function 'snd_rawmidi_free' argument 1 names different: declaration 'rawmidi' definition 'rmidi'. [funcArgNamesDifferent]
--- sound/core/rawmidi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/core/rawmidi.c +1 -1
@@ -35,7 +35,7 @@ module_param_array(amidi_map, int, NULL, 0444);MODULE_PARM_DESC (amidi_map,"Raw MIDI device number assigned to 2nd OSS device." );#endif /* CONFIG_SND_OSSEMUL */ -static int snd_rawmidi_free (struct snd_rawmidi *rawmidi); +static int snd_rawmidi_free (struct snd_rawmidi *rmidi);static int snd_rawmidi_dev_free (struct snd_device *device);static int snd_rawmidi_dev_register (struct snd_device *device);static int snd_rawmidi_dev_disconnect (struct snd_device *device);
Signature · 1 line
2.25.1
PATCH 16/18 ALSA: vx: vx_core: clarify operator precedence
In reply to Pierre-Louis BossartFix cppcheck warning
sound/drivers/vx/vx_core.c:600:49: style: Clarify calculation precedence for '&' and '?'. [clarifyCalculation]
chip->chip_status & VX_STAT_XILINX_LOADED ? "Loaded" : "No");
^
sound/drivers/vx/vx_core.c:602:47: style: Clarify calculation
precedence for '&' and '?'. [clarifyCalculation]
chip->chip_status & VX_STAT_DEVICE_INIT ? "Yes" : "No");
^--- sound/drivers/vx/vx_core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/drivers/vx/vx_core.c +2 -2
@@ -597,9 +597,9 @@ static void vx_proc_read(struct snd_info_entry *entry, struct snd_info_buffer *bsnd_iprintf (buffer,"%s\n" , chip->card->longname);snd_iprintf (buffer,"Xilinx Firmware: %s\n" , - chip->chip_status &VX_STAT_XILINX_LOADED ?"Loaded" :"No" ); + (chip->chip_status &VX_STAT_XILINX_LOADED ) ?"Loaded" :"No" );snd_iprintf (buffer,"Device Initialized: %s\n" , - chip->chip_status &VX_STAT_DEVICE_INIT ?"Yes" :"No" ); + (chip->chip_status &VX_STAT_DEVICE_INIT ) ?"Yes" :"No" );snd_iprintf (buffer,"DSP audio info:" );if (chip->audio_info &VX_AUDIO_INFO_REAL_TIME )snd_iprintf (buffer," realtime" );
Signature · 1 line
2.25.1
PATCH 17/18 ALSA: vx: vx_pcm: remove redundant assignment
In reply to Pierre-Louis BossartFix cppcheck warning:
sound/drivers/vx/vx_pcm.c:539:30: style: Variable 'chip->playback_pipes[audio]' is reassigned a value before the old one has been used. [redundantAssignment]
chip->playback_pipes[audio] = pipe;
^
sound/drivers/vx/vx_pcm.c:533:31: note: chip->playback_pipes[audio] is
assigned
chip->playback_pipes[audio] = pipe;
^
sound/drivers/vx/vx_pcm.c:539:30: note: chip->playback_pipes[audio] is
overwritten
chip->playback_pipes[audio] = pipe;
^--- sound/drivers/vx/vx_pcm.c | 1 - 1 file changed, 1 deletion(-)
sound/drivers/vx/vx_pcm.c +0 -1
@@ -530,7 +530,6 @@ static int vx_pcm_playback_open(struct snd_pcm_substream *subs) err =vx_alloc_pipe (chip,0 , audio,2 , &pipe);/* stereo playback */ if (err <0 )return err; - chip->playback_pipes[audio] = pipe; }/* open for playback */ pipe->references++;
Signature · 1 line
2.25.1
PATCH 18/18 ALSA: vx: vx_pcm: remove redundant assignment
In reply to Pierre-Louis BossartFix cppcheck warning:
sound/drivers/vx/vx_pcm.c:63:7: style: Variable 'buf' is assigned a value that is never used. [unreadVariable]
buf = (unsigned char *)runtime->dma_area;
^--- sound/drivers/vx/vx_pcm.c | 1 - 1 file changed, 1 deletion(-)
sound/drivers/vx/vx_pcm.c +0 -1
@@ -60,7 +60,6 @@ static void vx_pcm_read_per_bytes(struct vx_core *chip, struct snd_pcm_runtime * *buf++ =vx_inb (chip,RXL );if (++offset >= pipe->buffer_bytes) { offset =0 ; - buf = (unsigned char *)runtime->dma_area; } pipe->hw_ptr = offset; }
Signature · 1 line
2.25.1
Takashi Iwai
AppliedQuoted 15 lines · Pierre-Louis Bossart
Various cleanups for ALSA core, compressed, hda, usb, ac97 and Digigram cards.
Pierre-Louis Bossart (18):
ALSA: core: pcm: simplify locking for timers
ALSA: core: memalloc: fix fallthrough position
ALSA: core:pcm_memory: dereference pointer after NULL checks
ALSA: core: timer: remove redundant assignment
ALSA: core: timer: clarify operator precedence
ALSA:compress_offload: dereference after checking for NULL pointer
ALSA:compress_offload: remove redundant initialization
ALSA: core: init: useDECLARE_COMPLETION_ONSTACK()macro
ALSA: aoa: i2sbus: useDECLARE_COMPLETION_ONSTACK()macro
ALSA: hda:auto_parser: remove shadowed variable declaration
Quoted 8 lines
ALSA: hda: (cosmetic) align function parameters
ALSA: usb:scarless_gen2: fix endianness issue
ALSA: ac97: (cosmetic) align argument names
ALSA: atmel: ac97: clarify operator precedence
ALSA: rawmidi: (cosmetic) align function parameters
ALSA: vx:vx_core: clarify operator precedence
ALSA: vx:vx_pcm: remove redundant assignment
ALSA: vx:vx_pcm: remove redundant assignment
Applied all patches now. Thanks.
Takashi