ALSA: lola: NULL deref on allocation error
diff mbox

Message ID 20140305105225.GA3599@elgon.mountain
State Accepted
Delegated to: Takashi Iwai
Headers show

Commit Message

Dan Carpenter March 5, 2014, 10:55 a.m. UTC
"chip" is NULL here.  We don't need a printk here because kmalloc() has
it built in.

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

Comments

Takashi Iwai March 5, 2014, 11:11 a.m. UTC | #1
At Wed, 5 Mar 2014 13:55:09 +0300,
Dan Carpenter wrote:
> 
> "chip" is NULL here.  We don't need a printk here because kmalloc() has
> it built in.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Thanks, applied.


Takashi

> 
> diff --git a/sound/pci/lola/lola.c b/sound/pci/lola/lola.c
> index d63434d8c3fb..68824cdd137d 100644
> --- a/sound/pci/lola/lola.c
> +++ b/sound/pci/lola/lola.c
> @@ -586,7 +586,6 @@ static int lola_create(struct snd_card *card, struct pci_dev *pci,
>  
>  	chip = kzalloc(sizeof(*chip), GFP_KERNEL);
>  	if (!chip) {
> -		dev_err(chip->card->dev, "cannot allocate chip\n");
>  		pci_disable_device(pci);
>  		return -ENOMEM;
>  	}
>

Patch
diff mbox

diff --git a/sound/pci/lola/lola.c b/sound/pci/lola/lola.c
index d63434d8c3fb..68824cdd137d 100644
--- a/sound/pci/lola/lola.c
+++ b/sound/pci/lola/lola.c
@@ -586,7 +586,6 @@  static int lola_create(struct snd_card *card, struct pci_dev *pci,
 
 	chip = kzalloc(sizeof(*chip), GFP_KERNEL);
 	if (!chip) {
-		dev_err(chip->card->dev, "cannot allocate chip\n");
 		pci_disable_device(pci);
 		return -ENOMEM;
 	}