ASoC: ad1836: fix a memory leak if another ad1836 is registered
authorAxel Lin <[email protected]>
Fri, 23 Jul 2010 05:53:43 +0000 (05:53 +0000)
committerMark Brown <[email protected]>
Tue, 3 Aug 2010 06:40:26 +0000 (07:40 +0100)
ad1836 is allocated in ad1836_spi_probe() but is not freed if ad1836_register()
return -EINVAL (if another ad1836 is registered).

Signed-off-by: Axel Lin <[email protected]>
Acked-by: Barry Song <[email protected]>
Acked-by: Liam Girdwood <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
sound/soc/codecs/ad1836.c

index 217538423225950be0c338a57e3decf0919bb6b1..a01006c8c606ffd613b250bf7f95fbc95ebaa05c 100644 (file)
@@ -272,6 +272,7 @@ static int ad1836_register(struct ad1836_priv *ad1836)
 
        if (ad1836_codec) {
                dev_err(codec->dev, "Another ad1836 is registered\n");
+               kfree(ad1836);
                return -EINVAL;
        }