]> git.karo-electronics.de Git - linux-beck.git/commitdiff
ASoC: Convert wm8996 to use devm_kzalloc()
authorMark Brown <broonie@opensource.wolfsonmicro.com>
Sun, 27 Nov 2011 15:59:23 +0000 (15:59 +0000)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Sun, 27 Nov 2011 16:04:08 +0000 (16:04 +0000)
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
sound/soc/codecs/wm8996.c

index 304a0e570cb487bb428575e612018d04b886c008..41cc9d2d5ae9c36289e7ea687bcac8cfc5d213c2 100644 (file)
@@ -3104,7 +3104,8 @@ static __devinit int wm8996_i2c_probe(struct i2c_client *i2c,
        int ret, i;
        unsigned int reg;
 
-       wm8996 = kzalloc(sizeof(struct wm8996_priv), GFP_KERNEL);
+       wm8996 = devm_kzalloc(&i2c->dev, sizeof(struct wm8996_priv),
+                             GFP_KERNEL);
        if (wm8996 == NULL)
                return -ENOMEM;
 
@@ -3216,7 +3217,6 @@ err_gpio:
        if (wm8996->pdata.ldo_ena > 0)
                gpio_free(wm8996->pdata.ldo_ena);
 err:
-       kfree(wm8996);
 
        return ret;
 }
@@ -3234,7 +3234,6 @@ static __devexit int wm8996_i2c_remove(struct i2c_client *client)
                gpio_set_value_cansleep(wm8996->pdata.ldo_ena, 0);
                gpio_free(wm8996->pdata.ldo_ena);
        }
-       kfree(wm8996);
        return 0;
 }