aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@gmail.com>2011-12-28 23:06:39 -0500
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-01-02 07:28:12 -0500
commitd999c021b64289b571e5d295deade44e40cbcc4f (patch)
tree5a8a9e07e7b0ec241fdd621115510576a7e5d8de /sound/soc/codecs
parent8eeffe9891dbb74aedcb9a82da4733961d7b432f (diff)
ASoC: Convert sta32x to devm_kzalloc()
Signed-off-by: Axel Lin <axel.lin@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/codecs')
-rw-r--r--sound/soc/codecs/sta32x.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/sound/soc/codecs/sta32x.c b/sound/soc/codecs/sta32x.c
index 6648af6656c8..fbd145091356 100644
--- a/sound/soc/codecs/sta32x.c
+++ b/sound/soc/codecs/sta32x.c
@@ -968,28 +968,23 @@ static __devinit int sta32x_i2c_probe(struct i2c_client *i2c,
968 struct sta32x_priv *sta32x; 968 struct sta32x_priv *sta32x;
969 int ret; 969 int ret;
970 970
971 sta32x = kzalloc(sizeof(struct sta32x_priv), GFP_KERNEL); 971 sta32x = devm_kzalloc(&i2c->dev, sizeof(struct sta32x_priv),
972 GFP_KERNEL);
972 if (!sta32x) 973 if (!sta32x)
973 return -ENOMEM; 974 return -ENOMEM;
974 975
975 i2c_set_clientdata(i2c, sta32x); 976 i2c_set_clientdata(i2c, sta32x);
976 977
977 ret = snd_soc_register_codec(&i2c->dev, &sta32x_codec, &sta32x_dai, 1); 978 ret = snd_soc_register_codec(&i2c->dev, &sta32x_codec, &sta32x_dai, 1);
978 if (ret != 0) { 979 if (ret != 0)
979 dev_err(&i2c->dev, "Failed to register codec (%d)\n", ret); 980 dev_err(&i2c->dev, "Failed to register codec (%d)\n", ret);
980 kfree(sta32x);
981 return ret;
982 }
983 981
984 return 0; 982 return ret;
985} 983}
986 984
987static __devexit int sta32x_i2c_remove(struct i2c_client *client) 985static __devexit int sta32x_i2c_remove(struct i2c_client *client)
988{ 986{
989 struct sta32x_priv *sta32x = i2c_get_clientdata(client);
990
991 snd_soc_unregister_codec(&client->dev); 987 snd_soc_unregister_codec(&client->dev);
992 kfree(sta32x);
993 return 0; 988 return 0;
994} 989}
995 990