diff mbox

ALSA: pcxhr: NULL dereference on probe failure

Message ID 20141210132620.GB18593@mwanda (mailing list archive)
State Accepted
Commit 6e1d7a51392f06899bd7b693f28ac60fa1e00032
Headers show

Commit Message

Dan Carpenter Dec. 10, 2014, 1:26 p.m. UTC
"card" is NULL if snd_card_new() fails.

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

Comments

Takashi Iwai Dec. 10, 2014, 1:45 p.m. UTC | #1
At Wed, 10 Dec 2014 16:26:21 +0300,
Dan Carpenter wrote:
> 
> "card" is NULL if snd_card_new() fails.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Applied, thanks.


Takashi

> 
> diff --git a/sound/pci/pcxhr/pcxhr.c b/sound/pci/pcxhr/pcxhr.c
> index a602930..c6092e4 100644
> --- a/sound/pci/pcxhr/pcxhr.c
> +++ b/sound/pci/pcxhr/pcxhr.c
> @@ -1638,7 +1638,7 @@ static int pcxhr_probe(struct pci_dev *pci,
>  				   0, &card);
>  
>  		if (err < 0) {
> -			dev_err(card->dev, "cannot allocate the card %d\n", i);
> +			dev_err(&pci->dev, "cannot allocate the card %d\n", i);
>  			pcxhr_free(mgr);
>  			return err;
>  		}
>
diff mbox

Patch

diff --git a/sound/pci/pcxhr/pcxhr.c b/sound/pci/pcxhr/pcxhr.c
index a602930..c6092e4 100644
--- a/sound/pci/pcxhr/pcxhr.c
+++ b/sound/pci/pcxhr/pcxhr.c
@@ -1638,7 +1638,7 @@  static int pcxhr_probe(struct pci_dev *pci,
 				   0, &card);
 
 		if (err < 0) {
-			dev_err(card->dev, "cannot allocate the card %d\n", i);
+			dev_err(&pci->dev, "cannot allocate the card %d\n", i);
 			pcxhr_free(mgr);
 			return err;
 		}