ALSA: core: Use common error handling code in two functions
Subsystems (2)
PATCH 1/1 ALSA: core: Use common error handling code in two functions
From: Markus Elfring <[email protected]>
Date: Tue, 22 Aug 2017 21:01:01 +0200
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/core/pcm.c | 30 ++++++++++++++++++------------ sound/core/timer.c | 10 ++++++---- 2 files changed, 24 insertions(+), 16 deletions(-)
sound/core/pcm.c +18 -12
@@ -783,21 +783,27 @@ static int _snd_pcm_new(struct snd_card *card, const char *id, int device,INIT_LIST_HEAD (&pcm->list);if (id)strlcpy (pcm->id, id,sizeof (pcm->id)); -if ((err =snd_pcm_new_stream (pcm,SNDRV_PCM_STREAM_PLAYBACK , playback_count)) <0 ) { -snd_pcm_free (pcm); -return err; - } -if ((err =snd_pcm_new_stream (pcm,SNDRV_PCM_STREAM_CAPTURE , capture_count)) <0 ) { -snd_pcm_free (pcm); -return err; - } -if ((err =snd_device_new (card,SNDRV_DEV_PCM , pcm, &ops)) <0 ) { -snd_pcm_free (pcm); -return err; - } + + err =snd_pcm_new_stream (pcm,SNDRV_PCM_STREAM_PLAYBACK , + playback_count); +if (err <0 ) + goto free_pcm; + + err =snd_pcm_new_stream (pcm,SNDRV_PCM_STREAM_CAPTURE , capture_count); +if (err <0 ) + goto free_pcm; + + err =snd_device_new (card,SNDRV_DEV_PCM , pcm, &ops); +if (err <0 ) + goto free_pcm; +if (rpcm) *rpcm = pcm;return 0 ; + +free_pcm: +snd_pcm_free (pcm); +return err; }/**
sound/core/timer.c +6 -4
@@ -2096,8 +2096,7 @@ static int __init alsa_timer_init(void) err =snd_timer_register_system ();if (err <0 ) {pr_err ("ALSA: unable to register system timer (%i)\n" , err); -put_device (&timer_dev); -return err; + goto put_timer; } err = snd_register_device(SNDRV_DEVICE_TYPE_TIMER, NULL, 0,
@@ -2105,12 +2104,15 @@ static int __init alsa_timer_init(void)if (err <0 ) {pr_err ("ALSA: unable to register timer device (%i)\n" , err);snd_timer_free_all (); -put_device (&timer_dev); -return err; + goto put_timer; }snd_timer_proc_init ();return 0 ; + +put_timer: +put_device (&timer_dev); +return err; } static void __exit alsa_timer_exit(void)
Signature · 1 line
2.14.0
Quoted 10 lines · SF Markus Elfring
From: Markus Elfring <[email protected]>
Date: Tue, 22 Aug 2017 21:01:01 +0200Add 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.
Signed-off-by Markus Elfring <[email protected]>
Please don't mix the changes for both PCM and timer.
Takashi
Quoted 85 lines
--- sound/core/pcm.c | 30 ++++++++++++++++++------------ sound/core/timer.c | 10 ++++++---- 2 files changed, 24 insertions(+), 16 deletions(-)sound/core/pcm.c +18
-12@@ -783,21 +783,27 @@ static int _snd_pcm_new(struct snd_card *card, const char *id, int device,INIT_LIST_HEAD (&pcm->list);if (id)strlcpy (pcm->id, id,sizeof (pcm->id)); -if ((err =snd_pcm_new_stream (pcm,SNDRV_PCM_STREAM_PLAYBACK , playback_count)) <0 ) { -snd_pcm_free (pcm); -return err; - } -if ((err =snd_pcm_new_stream (pcm,SNDRV_PCM_STREAM_CAPTURE , capture_count)) <0 ) { -snd_pcm_free (pcm); -return err; - } -if ((err =snd_device_new (card,SNDRV_DEV_PCM , pcm, &ops)) <0 ) { -snd_pcm_free (pcm); -return err; - } + + err =snd_pcm_new_stream (pcm,SNDRV_PCM_STREAM_PLAYBACK , + playback_count); +if (err <0 ) + goto free_pcm; + + err =snd_pcm_new_stream (pcm,SNDRV_PCM_STREAM_CAPTURE , capture_count); +if (err <0 ) + goto free_pcm; + + err =snd_device_new (card,SNDRV_DEV_PCM , pcm, &ops); +if (err <0 ) + goto free_pcm; +if (rpcm) *rpcm = pcm;return 0 ; + +free_pcm: +snd_pcm_free (pcm); +return err; }/** sound/core/timer.c +6
-4@@ -2096,8 +2096,7 @@ static int __init alsa_timer_init(void) err =snd_timer_register_system ();if (err <0 ) {pr_err ("ALSA: unable to register system timer (%i)\n" , err); -put_device (&timer_dev); -return err; + goto put_timer; } err = snd_register_device(SNDRV_DEVICE_TYPE_TIMER, NULL, 0,@@ -2105,12 +2104,15 @@ static int __init alsa_timer_init(void)if (err <0 ) {pr_err ("ALSA: unable to register timer device (%i)\n" , err);snd_timer_free_all (); -put_device (&timer_dev); -return err; + goto put_timer; }snd_timer_proc_init ();return 0 ; + +put_timer: +put_device (&timer_dev); +return err; } static void __exit alsa_timer_exit(void)Signature · 1 line
2.14.0
cover ALSA: core: Fine-tuning for some function implementations
From: Markus Elfring <[email protected]>
Date: Wed, 23 Aug 2017 10:05:43 +0200
Some update suggestions were taken into account
from static source code analysis.
Markus Elfring (6):
pcm: Use common error handling code in _snd_pcm_new()
pcm: Adjust nine function calls together with a variable assignment
pcm: Adjust 11 checks for null pointers
timer: Use common error handling code in alsa_timer_init()
timer: Adjust a condition check in snd_timer_resolution()
timer: Adjust 13 checks for null pointers
sound/core/pcm.c | 90 +++++++++++++++++++++++++++++++----------------------- sound/core/timer.c | 39 ++++++++++++----------- 2 files changed, 73 insertions(+), 56 deletions(-)
Signature · 1 line
2.14.0
PATCH 1/6 ALSA: pcm: Use common error handling code in _snd_pcm_new()
From: Markus Elfring <[email protected]>
Date: Wed, 23 Aug 2017 08:40:37 +0200
Add a jump target so that a bit of exception handling can be better reused at the end of this function.
This issue was detected by using the Coccinelle software.
--- sound/core/pcm.c | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-)
sound/core/pcm.c +18 -12
@@ -783,21 +783,27 @@ static int _snd_pcm_new(struct snd_card *card, const char *id, int device,INIT_LIST_HEAD (&pcm->list);if (id)strlcpy (pcm->id, id,sizeof (pcm->id)); -if ((err =snd_pcm_new_stream (pcm,SNDRV_PCM_STREAM_PLAYBACK , playback_count)) <0 ) { -snd_pcm_free (pcm); -return err; - } -if ((err =snd_pcm_new_stream (pcm,SNDRV_PCM_STREAM_CAPTURE , capture_count)) <0 ) { -snd_pcm_free (pcm); -return err; - } -if ((err =snd_device_new (card,SNDRV_DEV_PCM , pcm, &ops)) <0 ) { -snd_pcm_free (pcm); -return err; - } + + err =snd_pcm_new_stream (pcm,SNDRV_PCM_STREAM_PLAYBACK , + playback_count); +if (err <0 ) + goto free_pcm; + + err =snd_pcm_new_stream (pcm,SNDRV_PCM_STREAM_CAPTURE , capture_count); +if (err <0 ) + goto free_pcm; + + err =snd_device_new (card,SNDRV_DEV_PCM , pcm, &ops); +if (err <0 ) + goto free_pcm; +if (rpcm) *rpcm = pcm;return 0 ; + +free_pcm: +snd_pcm_free (pcm); +return err; }/**
Signature · 1 line
2.14.0
PATCH 2/6 ALSA: pcm: Adjust nine function calls together with a variable assignment
In reply to SF Markus ElfringFrom: Markus Elfring <[email protected]>
Date: Wed, 23 Aug 2017 09:20:29 +0200
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/core/pcm.c | 38 +++++++++++++++++++++++--------------- 1 file changed, 23 insertions(+), 15 deletions(-)
sound/core/pcm.c +23 -15
@@ -523,7 +523,9 @@ static int snd_pcm_stream_proc_init(struct snd_pcm_str *pstr)sprintf (name,"pcm%i%c" , pcm->device, pstr->stream =SNDRV_PCM_STREAM_PLAYBACK ?'p' :'c' ); -if ((entry =snd_info_create_card_entry (pcm->card, name, pcm->card->proc_root)) =NULL ) + entry =snd_info_create_card_entry (pcm->card, name, + pcm->card->proc_root); +if (!entry)return -ENOMEM ; entry->mode =S_IFDIR |S_IRUGO |S_IXUGO ;if (snd_info_register (entry) <0 ) {
@@ -531,8 +533,8 @@ static int snd_pcm_stream_proc_init(struct snd_pcm_str *pstr)return -ENOMEM ; } pstr->proc_root = entry; - -if ((entry =snd_info_create_card_entry (pcm->card,"info" , pstr->proc_root)) !=NULL ) { + entry =snd_info_create_card_entry (pcm->card,"info" , pstr->proc_root); +if (entry) {snd_info_set_text_ops (entry, pstr, snd_pcm_stream_proc_info_read);if (snd_info_register (entry) <0 ) {snd_info_free_entry (entry);
@@ -542,8 +544,9 @@ static int snd_pcm_stream_proc_init(struct snd_pcm_str *pstr) pstr->proc_info_entry = entry;#ifdef CONFIG_SND_PCM_XRUN_DEBUG -if ((entry =snd_info_create_card_entry (pcm->card,"xrun_debug" , - pstr->proc_root)) !=NULL ) { + entry =snd_info_create_card_entry (pcm->card,"xrun_debug" , + pstr->proc_root); +if (entry) { entry->c.text.read = snd_pcm_xrun_debug_read; entry->c.text.write = snd_pcm_xrun_debug_write; entry->mode |=S_IWUSR ;
@@ -580,7 +583,9 @@ static int snd_pcm_substream_proc_init(struct snd_pcm_substream *substream) card = substream->pcm->card;sprintf (name,"sub%i" , substream->number); -if ((entry =snd_info_create_card_entry (card, name, substream->pstr->proc_root)) =NULL ) + entry =snd_info_create_card_entry (card, name, + substream->pstr->proc_root); +if (!entry)return -ENOMEM ; entry->mode =S_IFDIR |S_IRUGO |S_IXUGO ;if (snd_info_register (entry) <0 ) {
@@ -588,8 +593,8 @@ static int snd_pcm_substream_proc_init(struct snd_pcm_substream *substream)return -ENOMEM ; } substream->proc_root = entry; - -if ((entry =snd_info_create_card_entry (card,"info" , substream->proc_root)) !=NULL ) { + entry =snd_info_create_card_entry (card,"info" , substream->proc_root); +if (entry) {snd_info_set_text_ops (entry, substream, snd_pcm_substream_proc_info_read);if (snd_info_register (entry) <0 ) {
@@ -598,8 +603,9 @@ static int snd_pcm_substream_proc_init(struct snd_pcm_substream *substream) } } substream->proc_info_entry = entry; - -if ((entry =snd_info_create_card_entry (card,"hw_params" , substream->proc_root)) !=NULL ) { + entry =snd_info_create_card_entry (card,"hw_params" , + substream->proc_root); +if (entry) {snd_info_set_text_ops (entry, substream, snd_pcm_substream_proc_hw_params_read);if (snd_info_register (entry) <0 ) {
@@ -608,8 +614,9 @@ static int snd_pcm_substream_proc_init(struct snd_pcm_substream *substream) } } substream->proc_hw_params_entry = entry; - -if ((entry =snd_info_create_card_entry (card,"sw_params" , substream->proc_root)) !=NULL ) { + entry =snd_info_create_card_entry (card,"sw_params" , + substream->proc_root); +if (entry) {snd_info_set_text_ops (entry, substream, snd_pcm_substream_proc_sw_params_read);if (snd_info_register (entry) <0 ) {
@@ -618,8 +625,8 @@ static int snd_pcm_substream_proc_init(struct snd_pcm_substream *substream) } } substream->proc_sw_params_entry = entry; - -if ((entry =snd_info_create_card_entry (card,"status" , substream->proc_root)) !=NULL ) { + entry =snd_info_create_module_entry (THIS_MODULE ,"pcm" ,NULL ); +if (entry) {snd_info_set_text_ops (entry, substream, snd_pcm_substream_proc_status_read);if (snd_info_register (entry) <0 ) {
@@ -1230,7 +1237,8 @@ static void snd_pcm_proc_init(void) {struct snd_info_entry *entry; -if ((entry =snd_info_create_module_entry (THIS_MODULE ,"pcm" ,NULL )) !=NULL ) { + entry =snd_info_create_module_entry (THIS_MODULE ,"pcm" ,NULL ); +if (entry) {snd_info_set_text_ops (entry,NULL , snd_pcm_proc_read);if (snd_info_register (entry) <0 ) {snd_info_free_entry (entry);
Signature · 1 line
2.14.0
PATCH 3/6 ALSA: pcm: Adjust 11 checks for null pointers
In reply to SF Markus ElfringFrom: Markus Elfring <[email protected]>
Date: Wed, 23 Aug 2017 09:28:00 +0200
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/core/pcm.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-)
sound/core/pcm.c +11 -11
@@ -132,7 +132,7 @@ static int snd_pcm_control_ioctl(struct snd_card *card,return -EFAULT ;mutex_lock (®ister_mutex); pcm =snd_pcm_get (card, device); -if (pcm =NULL ) { +if (!pcm) { err = -ENXIO ; goto _error; }
@@ -149,7 +149,7 @@ static int snd_pcm_control_ioctl(struct snd_card *card, substream = substream->next)if (substream->number = (int )subdevice)break ; -if (substream =NULL ) { +if (!substream) { err = -ENXIO ; goto _error; }
@@ -733,7 +733,7 @@ int snd_pcm_new_stream(struct snd_pcm *pcm, int stream, int substream_count) substream->stream = stream;sprintf (substream->name,"subdevice #%i" , idx); substream->buffer_bytes_max =UINT_MAX ; -if (prev =NULL ) +if (!prev) pstr->substream = substream;else prev->next = substream;
@@ -743,7 +743,7 @@ int snd_pcm_new_stream(struct snd_pcm *pcm, int stream, int substream_count)if (err <0 ) {pcm_err (pcm,"Error in snd_pcm_stream_proc_init\n" ); -if (prev =NULL ) +if (!prev) pstr->substream =NULL ;else prev->next =NULL ;
@@ -951,7 +951,7 @@ int snd_pcm_attach_substream(struct snd_pcm *pcm, int stream,return -EINVAL ; *rsubstream =NULL ; pstr = &pcm->streams[stream]; -if (pstr->substream =NULL || pstr->substream_count =0 ) +if (!pstr->substream || pstr->substream_count =0 )return -ENODEV ; card = pcm->card;
@@ -993,16 +993,16 @@ int snd_pcm_attach_substream(struct snd_pcm *pcm, int stream, substream->number = prefer_subdevice))break ; } -if (substream =NULL ) +if (!substream)return -EAGAIN ; runtime =kzalloc (sizeof (*runtime),GFP_KERNEL ); -if (runtime =NULL ) +if (!runtime)return -ENOMEM ; size =PAGE_ALIGN (sizeof (struct snd_pcm_mmap_status )); runtime->status =snd_malloc_pages (size,GFP_KERNEL ); -if (runtime->status =NULL ) { +if (!runtime->status) {kfree (runtime);return -ENOMEM ; }
@@ -1010,7 +1010,7 @@ int snd_pcm_attach_substream(struct snd_pcm *pcm, int stream, size =PAGE_ALIGN (sizeof (struct snd_pcm_mmap_control )); runtime->control =snd_malloc_pages (size,GFP_KERNEL ); -if (runtime->control =NULL ) { +if (!runtime->control) {snd_free_pages ((void *)runtime->status,PAGE_ALIGN (sizeof (struct snd_pcm_mmap_status )));kfree (runtime);
@@ -1040,7 +1040,7 @@ void snd_pcm_detach_substream(struct snd_pcm_substream *substream)if (PCM_RUNTIME_CHECK (substream))return ; runtime = substream->runtime; -if (runtime->private_free !=NULL ) +if (runtime->private_free) runtime->private_free (runtime);snd_free_pages ((void *)runtime->status,PAGE_ALIGN (sizeof (struct snd_pcm_mmap_status )));
@@ -1107,7 +1107,7 @@ static int snd_pcm_dev_register(struct snd_device *device) goto unlock;for (cidx =0 ; cidx <2 ; cidx++) {int devtype =-1 ; -if (pcm->streams[cidx].substream =NULL ) +if (!pcm->streams[cidx].substream)continue ;switch (cidx) {case SNDRV_PCM_STREAM_PLAYBACK :
Signature · 1 line
2.14.0
PATCH 4/6 ALSA: timer: Use common error handling code in alsa_timer_init()
In reply to SF Markus ElfringFrom: Markus Elfring <[email protected]>
Date: Wed, 23 Aug 2017 09:30:41 +0200
Add a jump target so that a bit of exception handling can be better reused at the end of this function.
This issue was detected by using the Coccinelle software.
--- sound/core/timer.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
sound/core/timer.c +6 -4
@@ -2096,8 +2096,7 @@ static int __init alsa_timer_init(void) err =snd_timer_register_system ();if (err <0 ) {pr_err ("ALSA: unable to register system timer (%i)\n" , err); -put_device (&timer_dev); -return err; + goto put_timer; } err = snd_register_device(SNDRV_DEVICE_TYPE_TIMER, NULL, 0,
@@ -2105,12 +2104,15 @@ static int __init alsa_timer_init(void)if (err <0 ) {pr_err ("ALSA: unable to register timer device (%i)\n" , err);snd_timer_free_all (); -put_device (&timer_dev); -return err; + goto put_timer; }snd_timer_proc_init ();return 0 ; + +put_timer: +put_device (&timer_dev); +return err; } static void __exit alsa_timer_exit(void)
Signature · 1 line
2.14.0
PATCH 5/6 ALSA: timer: Adjust a condition check in snd_timer_resolution()
In reply to SF Markus ElfringFrom: Markus Elfring <[email protected]>
Date: Wed, 23 Aug 2017 09:45:06 +0200
The script "checkpatch.pl" pointed information out like the following.
ERROR: do not use assignment in if condition
Thus fix the affected source code place.
--- sound/core/timer.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
sound/core/timer.c +2 -1
@@ -395,5 +395,6 @@ unsigned long snd_timer_resolution(struct snd_timer_instance *timeri)return 0 ; -if ((timer = timeri->timer) !=NULL ) { + timer = timeri->timer; +if (timer) {if (timer->hw.c_resolution)return timer->hw.c_resolution (timer);return timer->hw.resolution;
Signature · 1 line
2.14.0
PATCH 6/6 ALSA: timer: Adjust 13 checks for null pointers
In reply to SF Markus ElfringFrom: Markus Elfring <[email protected]>
Date: Wed, 23 Aug 2017 09:54:42 +0200
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/core/timer.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-)
sound/core/timer.c +13 -13
@@ -106,7 +106,7 @@ static struct snd_timer_instance *snd_timer_instance_new(char *owner, {struct snd_timer_instance *timeri; timeri =kzalloc (sizeof (*timeri),GFP_KERNEL ); -if (timeri =NULL ) +if (!timeri)return NULL ; timeri->owner =kstrdup (owner,GFP_KERNEL );if (! timeri->owner) {
@@ -141,7 +141,7 @@ static struct snd_timer *snd_timer_find(struct snd_timer_id *tid)continue ;if ((timer->tmr_class =SNDRV_TIMER_CLASS_CARD || timer->tmr_class =SNDRV_TIMER_CLASS_PCM ) && - (timer->card =NULL || + (!timer->card || timer->card->number != tid->card))continue ;if (timer->tmr_device != tid->device)
@@ -391,5 +391,5 @@ unsigned long snd_timer_resolution(struct snd_timer_instance *timeri) {struct snd_timer * timer; -if (timeri =NULL ) +if (!timeri)return 0 ;
@@ -425,7 +425,7 @@ static void snd_timer_notify1(struct snd_timer_instance *ti, int event)if (ti->flags &SNDRV_TIMER_IFLG_SLAVE )return ; timer = ti->timer; -if (timer =NULL ) +if (!timer)return ;if (timer->hw.flags &SNDRV_TIMER_HW_SLAVE )return ;
@@ -586,7 +586,7 @@ static int snd_timer_stop_slave(struct snd_timer_instance *timeri, bool stop)*/ int snd_timer_start (struct snd_timer_instance *timeri,unsigned int ticks) { -if (timeri =NULL || ticks <1 ) +if (!timeri || ticks <1 )return -EINVAL ;if (timeri->flags &SNDRV_TIMER_IFLG_SLAVE )return snd_timer_start_slave (timeri, true);
@@ -722,7 +722,7 @@ void snd_timer_interrupt(struct snd_timer * timer, unsigned long ticks_left)unsigned long flags;int use_tasklet =0 ; -if (timer =NULL ) +if (!timer)return ;if (timer->card && timer->card->shutdown)
@@ -856,7 +856,7 @@ int snd_timer_new(struct snd_card *card, char *id, struct snd_timer_id *tid,spin_lock_init (&timer->lock);tasklet_init (&timer->task_queue, snd_timer_tasklet, (unsigned long )timer); -if (card !=NULL ) { +if (card) { timer->module = card->module; err =snd_device_new (card,SNDRV_DEV_TIMER , timer, &ops);if (err <0 ) {
@@ -909,7 +909,7 @@ static int snd_timer_dev_register(struct snd_device *dev)if (snd_BUG_ON (!timer || !timer->hw.start || !timer->hw.stop))return -ENXIO ;if (!(timer->hw.flags &SNDRV_TIMER_HW_SLAVE ) && - !timer->hw.resolution && timer->hw.c_resolution =NULL ) + !timer->hw.resolution && !timer->hw.c_resolution)return -EINVAL ;mutex_lock (®ister_mutex);
@@ -1114,7 +1114,7 @@ static int snd_timer_register_system(void)strcpy (timer->name,"system timer" ); timer->hw = snd_timer_system; priv =kzalloc (sizeof (*priv),GFP_KERNEL ); -if (priv =NULL ) { +if (!priv) {snd_timer_free (timer);return -ENOMEM ; }
@@ -1182,7 +1182,7 @@ static void __init snd_timer_proc_init(void)struct snd_info_entry *entry; entry =snd_info_create_module_entry (THIS_MODULE ,"timers" ,NULL ); -if (entry !=NULL ) { +if (entry) { entry->c.text.read = snd_timer_proc_read;if (snd_info_register (entry) <0 ) {snd_info_free_entry (entry);
@@ -1378,7 +1378,7 @@ static int snd_timer_user_open(struct inode *inode, struct file *file)return err; tu =kzalloc (sizeof (*tu),GFP_KERNEL ); -if (tu =NULL ) +if (!tu)return -ENOMEM ;spin_lock_init (&tu->qlock);init_waitqueue_head (&tu->qchange_sleep);
@@ -1537,7 +1537,7 @@ static int snd_timer_user_ginfo(struct file *file, ginfo->tid = tid;mutex_lock (®ister_mutex); t =snd_timer_find (&tid); -if (t !=NULL ) { +if (t) { ginfo->card = t->card ? t->card->number :-1 ;if (t->hw.flags &SNDRV_TIMER_HW_SLAVE ) ginfo->flags |=SNDRV_TIMER_FLG_SLAVE ;
@@ -1611,7 +1611,7 @@ static int snd_timer_user_gstatus(struct file *file, gstatus.tid = tid;mutex_lock (®ister_mutex); t =snd_timer_find (&tid); -if (t !=NULL ) { +if (t) {if (t->hw.c_resolution) gstatus.resolution = t->hw.c_resolution (t);else
Signature · 1 line
2.14.0
Re: [PATCH 3/6] ALSA: pcm: Adjust 11 checks for null pointers
In reply to SF Markus ElfringQuoted 7 lines · SF Markus Elfring
From: Markus Elfring <[email protected]>
Date: Wed, 23 Aug 2017 09:28:00 +0200
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Quoted 7 lines
The script “checkpatch.pl” pointed information out like the following.
Comparison to NULL could be written …
Thus fix the affected source code places.
Signed-off-by Markus Elfring <[email protected]>
Converting only these alone doesn't give any big merit. Another patch in the series fixed the style if ((err = xxx)), so it's fine, though.
checkpatch is no bible, after all.
thanks,
Takashi
Takashi Iwai
AppliedRe: [PATCH 1/6] ALSA: pcm: Use common error handling code in _snd_pcm_new()
In reply to SF Markus ElfringQuoted 10 lines · SF Markus Elfring
From: Markus Elfring <[email protected]>
Date: Wed, 23 Aug 2017 08:40:37 +0200Add a jump target so that a bit of exception handling can be better reused at the end of this function.
This issue was detected by using the Coccinelle software.
Signed-off-by Markus Elfring <[email protected]>
Applied, thanks.
Takashi
Takashi Iwai
AppliedRe: [PATCH 2/6] ALSA: pcm: Adjust nine function calls together with a variable assignment
In reply to SF Markus ElfringQuoted 11 lines · SF Markus Elfring
From: Markus Elfring <[email protected]>
Date: Wed, 23 Aug 2017 09:20:29 +0200The script "checkpatch.pl" pointed information out like the following.
ERROR: do not use assignment in if condition
Thus fix the affected source code places.
Signed-off-by Markus Elfring <[email protected]>
Applied, thanks.
Takashi
Takashi Iwai
AppliedRe: [PATCH 5/6] ALSA: timer: Adjust a condition check in snd_timer_resolution()
In reply to SF Markus ElfringQuoted 11 lines · SF Markus Elfring
From: Markus Elfring <[email protected]>
Date: Wed, 23 Aug 2017 09:45:06 +0200The script "checkpatch.pl" pointed information out like the following.
ERROR: do not use assignment in if condition
Thus fix the affected source code place.
Signed-off-by Markus Elfring <[email protected]>
Applied, thanks.
Takashi
Re: [PATCH 6/6] ALSA: timer: Adjust 13 checks for null pointers
In reply to SF Markus ElfringQuoted 7 lines · SF Markus Elfring
From: Markus Elfring <[email protected]>
Date: Wed, 23 Aug 2017 09:54:42 +0200
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Quoted 7 lines
The script “checkpatch.pl” pointed information out like the following.
Comparison to NULL could be written …
Thus fix the affected source code places.
Signed-off-by Markus Elfring <[email protected]>
I won't apply this either for the same reason as patch 3.
thanks,
Takashi
Takashi Iwai
AppliedRe: [PATCH 4/6] ALSA: timer: Use common error handling code in alsa_timer_init()
In reply to SF Markus ElfringQuoted 10 lines · SF Markus Elfring
From: Markus Elfring <[email protected]>
Date: Wed, 23 Aug 2017 09:30:41 +0200Add a jump target so that a bit of exception handling can be better reused at the end of this function.
This issue was detected by using the Coccinelle software.
Signed-off-by Markus Elfring <[email protected]>
Applied, thanks.
Takashi