Skip to content

Commit

Permalink
ASoC: Convert sgtl5000 to use devm_kzalloc()
Browse files Browse the repository at this point in the history
Convert sgtl5000 codec driver to use devm_kzalloc().

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
  • Loading branch information
Fabio Estevam authored and Mark Brown committed Dec 28, 2011
1 parent cf1ee98 commit 512fa7c
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions sound/soc/codecs/sgtl5000.c
Original file line number Diff line number Diff line change
Expand Up @@ -1401,30 +1401,22 @@ static __devinit int sgtl5000_i2c_probe(struct i2c_client *client,
struct sgtl5000_priv *sgtl5000;
int ret;

sgtl5000 = kzalloc(sizeof(struct sgtl5000_priv), GFP_KERNEL);
sgtl5000 = devm_kzalloc(&client->dev, sizeof(struct sgtl5000_priv),
GFP_KERNEL);
if (!sgtl5000)
return -ENOMEM;

i2c_set_clientdata(client, sgtl5000);

ret = snd_soc_register_codec(&client->dev,
&sgtl5000_driver, &sgtl5000_dai, 1);
if (ret) {
dev_err(&client->dev, "Failed to register codec: %d\n", ret);
kfree(sgtl5000);
return ret;
}

return 0;
return ret;
}

static __devexit int sgtl5000_i2c_remove(struct i2c_client *client)
{
struct sgtl5000_priv *sgtl5000 = i2c_get_clientdata(client);

snd_soc_unregister_codec(&client->dev);

kfree(sgtl5000);
return 0;
}

Expand Down

0 comments on commit 512fa7c

Please sign in to comment.