ALSA: sparc: Add missing kfree in error path
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Fri, 17 Jul 2015 18:33:21 +0000 (20:33 +0200)
committerTakashi Iwai <tiwai@suse.de>
Fri, 17 Jul 2015 20:29:43 +0000 (22:29 +0200)
If 'of_ioremap' fails, then 'amd' should be freed, otherwise, there is a
memory leak.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/sparc/amd7930.c

index 1b1a89e80d1394bb253aecc3cadc683dbcff3a36..784ceb85b2d9fe7cbe989d0c8443863f1d03df34 100644 (file)
@@ -956,6 +956,7 @@ static int snd_amd7930_create(struct snd_card *card,
        if (!amd->regs) {
                snd_printk(KERN_ERR
                           "amd7930-%d: Unable to map chip registers.\n", dev);
+               kfree(amd);
                return -EIO;
        }