Skip to content

Commit

Permalink
ASoC: Convert da7210 to devm_kzalloc()
Browse files Browse the repository at this point in the history
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
  • Loading branch information
Axel Lin authored and Mark Brown committed Dec 27, 2011
1 parent 2c9d9b6 commit 306bf6b
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions sound/soc/codecs/da7210.c
Original file line number Diff line number Diff line change
Expand Up @@ -944,7 +944,8 @@ static int __devinit da7210_i2c_probe(struct i2c_client *i2c,
struct da7210_priv *da7210;
int ret;

da7210 = kzalloc(sizeof(struct da7210_priv), GFP_KERNEL);
da7210 = devm_kzalloc(&i2c->dev, sizeof(struct da7210_priv),
GFP_KERNEL);
if (!da7210)
return -ENOMEM;

Expand All @@ -953,16 +954,12 @@ static int __devinit da7210_i2c_probe(struct i2c_client *i2c,

ret = snd_soc_register_codec(&i2c->dev,
&soc_codec_dev_da7210, &da7210_dai, 1);
if (ret < 0)
kfree(da7210);

return ret;
}

static int __devexit da7210_i2c_remove(struct i2c_client *client)
{
snd_soc_unregister_codec(&client->dev);
kfree(i2c_get_clientdata(client));
return 0;
}

Expand Down

0 comments on commit 306bf6b

Please sign in to comment.