ASoC: Convert adau1701 to devm_kzalloc()
authorAxel Lin <axel.lin@gmail.com>
Mon, 26 Dec 2011 12:53:09 +0000 (20:53 +0800)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Wed, 28 Dec 2011 17:22:40 +0000 (17:22 +0000)
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
sound/soc/codecs/adau1701.c

index 6a6af567f02a9042cc280266762fe388fe8632ce..6b325ea03869f4758247cec758c96ed71ab60b7e 100644 (file)
@@ -496,23 +496,19 @@ static __devinit int adau1701_i2c_probe(struct i2c_client *client,
        struct adau1701 *adau1701;
        int ret;
 
-       adau1701 = kzalloc(sizeof(*adau1701), GFP_KERNEL);
+       adau1701 = devm_kzalloc(&client->dev, sizeof(*adau1701), GFP_KERNEL);
        if (!adau1701)
                return -ENOMEM;
 
        i2c_set_clientdata(client, adau1701);
        ret = snd_soc_register_codec(&client->dev, &adau1701_codec_drv,
                        &adau1701_dai, 1);
-       if (ret < 0)
-               kfree(adau1701);
-
        return ret;
 }
 
 static __devexit int adau1701_i2c_remove(struct i2c_client *client)
 {
        snd_soc_unregister_codec(&client->dev);
-       kfree(i2c_get_clientdata(client));
        return 0;
 }