]> git.karo-electronics.de Git - linux-beck.git/commitdiff
ASoC: ml26124: Convert to devm_regmap_init_i2c
authorAxel Lin <axel.lin@gmail.com>
Wed, 13 Jun 2012 06:36:07 +0000 (14:36 +0800)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Wed, 13 Jun 2012 09:27:27 +0000 (17:27 +0800)
This fixes a leak if snd_soc_register_codec fails.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
sound/soc/codecs/ml26124.c

index 22cb5bf59273dcbfde850dd6243a138cbdce003f..96aa5fa051609357cda4555e52bd4d4b5b509909 100644 (file)
@@ -638,7 +638,7 @@ static __devinit int ml26124_i2c_probe(struct i2c_client *i2c,
 
        i2c_set_clientdata(i2c, priv);
 
-       priv->regmap = regmap_init_i2c(i2c, &ml26124_i2c_regmap);
+       priv->regmap = devm_regmap_init_i2c(i2c, &ml26124_i2c_regmap);
        if (IS_ERR(priv->regmap)) {
                ret = PTR_ERR(priv->regmap);
                dev_err(&i2c->dev, "regmap_init_i2c() failed: %d\n", ret);
@@ -651,10 +651,7 @@ static __devinit int ml26124_i2c_probe(struct i2c_client *i2c,
 
 static __devexit int ml26124_i2c_remove(struct i2c_client *client)
 {
-       struct ml26124_priv *priv = i2c_get_clientdata(client);
-
        snd_soc_unregister_codec(&client->dev);
-       regmap_exit(priv->regmap);
        return 0;
 }