diff mbox

sound: oss: uart401: remove unneeded NULL check

Message ID 20141122182901.GA6994@mwanda (mailing list archive)
State Accepted
Commit 4fc390a198c41a007c02f82f41ad100c7c67b55e
Headers show

Commit Message

Dan Carpenter Nov. 22, 2014, 6:29 p.m. UTC
"devc" can't be NULL here so there is no need to check.  Also I removed
the "devc = NULL" assignment because devc is stored on stack so it's
a no-op.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Comments

Takashi Iwai Nov. 22, 2014, 8:49 p.m. UTC | #1
At Sat, 22 Nov 2014 21:29:01 +0300,
Dan Carpenter wrote:
> 
> "devc" can't be NULL here so there is no need to check.  Also I removed
> the "devc = NULL" assignment because devc is stored on stack so it's
> a no-op.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Thanks, applied.


Takashi

> 
> diff --git a/sound/oss/uart401.c b/sound/oss/uart401.c
> index 279bc56..dae4d43 100644
> --- a/sound/oss/uart401.c
> +++ b/sound/oss/uart401.c
> @@ -412,13 +412,10 @@ void unload_uart401(struct address_info *hw_config)
>  
>  	if (!devc->share_irq)
>  		free_irq(devc->irq, devc);
> -	if (devc)
> -	{
> -		kfree(midi_devs[devc->my_dev]->converter);
> -		kfree(midi_devs[devc->my_dev]);
> -		kfree(devc);
> -		devc = NULL;
> -	}
> +	kfree(midi_devs[devc->my_dev]->converter);
> +	kfree(midi_devs[devc->my_dev]);
> +	kfree(devc);
> +
>  	/* This kills midi_devs[x] */
>  	sound_unload_mididev(hw_config->slots[4]);
>  }
>
diff mbox

Patch

diff --git a/sound/oss/uart401.c b/sound/oss/uart401.c
index 279bc56..dae4d43 100644
--- a/sound/oss/uart401.c
+++ b/sound/oss/uart401.c
@@ -412,13 +412,10 @@  void unload_uart401(struct address_info *hw_config)
 
 	if (!devc->share_irq)
 		free_irq(devc->irq, devc);
-	if (devc)
-	{
-		kfree(midi_devs[devc->my_dev]->converter);
-		kfree(midi_devs[devc->my_dev]);
-		kfree(devc);
-		devc = NULL;
-	}
+	kfree(midi_devs[devc->my_dev]->converter);
+	kfree(midi_devs[devc->my_dev]);
+	kfree(devc);
+
 	/* This kills midi_devs[x] */
 	sound_unload_mididev(hw_config->slots[4]);
 }