diff mbox

[1/1] ALSA: core: Deletion of unnecessary checks before two function calls

Message ID 546F7921.2000406@users.sourceforge.net (mailing list archive)
State Accepted
Commit d712eaf29d3fe5928d891a4a90ac58644ad595ed
Headers show

Commit Message

SF Markus Elfring Nov. 21, 2014, 5:40 p.m. UTC
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 21 Nov 2014 18:34:48 +0100

The functions snd_seq_oss_timer_delete() and vunmap() perform also input
parameter validation. Thus the test around the call is not needed.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 sound/core/seq/oss/seq_oss_init.c | 9 +++------
 sound/core/sgbuf.c                | 3 +--
 2 files changed, 4 insertions(+), 8 deletions(-)

Comments

Takashi Iwai Nov. 21, 2014, 7:07 p.m. UTC | #1
At Fri, 21 Nov 2014 18:40:49 +0100,
SF Markus Elfring wrote:
> 
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Fri, 21 Nov 2014 18:34:48 +0100
> 
> The functions snd_seq_oss_timer_delete() and vunmap() perform also input
> parameter validation. Thus the test around the call is not needed.
> 
> This issue was detected by using the Coccinelle software.
> 
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>

Applied, thanks.


Takashi

> ---
>  sound/core/seq/oss/seq_oss_init.c | 9 +++------
>  sound/core/sgbuf.c                | 3 +--
>  2 files changed, 4 insertions(+), 8 deletions(-)
> 
> diff --git a/sound/core/seq/oss/seq_oss_init.c b/sound/core/seq/oss/seq_oss_init.c
> index b9184d2..b0e32e1 100644
> --- a/sound/core/seq/oss/seq_oss_init.c
> +++ b/sound/core/seq/oss/seq_oss_init.c
> @@ -403,14 +403,11 @@ free_devinfo(void *private)
>  {
>  	struct seq_oss_devinfo *dp = (struct seq_oss_devinfo *)private;
>  
> -	if (dp->timer)
> -		snd_seq_oss_timer_delete(dp->timer);
> +	snd_seq_oss_timer_delete(dp->timer);
>  		
> -	if (dp->writeq)
> -		snd_seq_oss_writeq_delete(dp->writeq);
> +	snd_seq_oss_writeq_delete(dp->writeq);
>  
> -	if (dp->readq)
> -		snd_seq_oss_readq_delete(dp->readq);
> +	snd_seq_oss_readq_delete(dp->readq);
>  	
>  	kfree(dp);
>  }
> diff --git a/sound/core/sgbuf.c b/sound/core/sgbuf.c
> index 0a41850..84fffab 100644
> --- a/sound/core/sgbuf.c
> +++ b/sound/core/sgbuf.c
> @@ -39,8 +39,7 @@ int snd_free_sgbuf_pages(struct snd_dma_buffer *dmab)
>  	if (! sgbuf)
>  		return -EINVAL;
>  
> -	if (dmab->area)
> -		vunmap(dmab->area);
> +	vunmap(dmab->area);
>  	dmab->area = NULL;
>  
>  	tmpb.dev.type = SNDRV_DMA_TYPE_DEV;
> -- 
> 2.1.3
>
diff mbox

Patch

diff --git a/sound/core/seq/oss/seq_oss_init.c b/sound/core/seq/oss/seq_oss_init.c
index b9184d2..b0e32e1 100644
--- a/sound/core/seq/oss/seq_oss_init.c
+++ b/sound/core/seq/oss/seq_oss_init.c
@@ -403,14 +403,11 @@  free_devinfo(void *private)
 {
 	struct seq_oss_devinfo *dp = (struct seq_oss_devinfo *)private;
 
-	if (dp->timer)
-		snd_seq_oss_timer_delete(dp->timer);
+	snd_seq_oss_timer_delete(dp->timer);
 		
-	if (dp->writeq)
-		snd_seq_oss_writeq_delete(dp->writeq);
+	snd_seq_oss_writeq_delete(dp->writeq);
 
-	if (dp->readq)
-		snd_seq_oss_readq_delete(dp->readq);
+	snd_seq_oss_readq_delete(dp->readq);
 	
 	kfree(dp);
 }
diff --git a/sound/core/sgbuf.c b/sound/core/sgbuf.c
index 0a41850..84fffab 100644
--- a/sound/core/sgbuf.c
+++ b/sound/core/sgbuf.c
@@ -39,8 +39,7 @@  int snd_free_sgbuf_pages(struct snd_dma_buffer *dmab)
 	if (! sgbuf)
 		return -EINVAL;
 
-	if (dmab->area)
-		vunmap(dmab->area);
+	vunmap(dmab->area);
 	dmab->area = NULL;
 
 	tmpb.dev.type = SNDRV_DMA_TYPE_DEV;