Commit 6e4f17cb authored by Axel Lin's avatar Axel Lin Committed by Mark Brown

ASoC: Convert ad1836 to devm_kzalloc()

Signed-off-by: default avatarAxel Lin <axel.lin@gmail.com>
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
parent 80c2f9da
...@@ -341,7 +341,8 @@ static int __devinit ad1836_spi_probe(struct spi_device *spi) ...@@ -341,7 +341,8 @@ static int __devinit ad1836_spi_probe(struct spi_device *spi)
struct ad1836_priv *ad1836; struct ad1836_priv *ad1836;
int ret; int ret;
ad1836 = kzalloc(sizeof(struct ad1836_priv), GFP_KERNEL); ad1836 = devm_kzalloc(&spi->dev, sizeof(struct ad1836_priv),
GFP_KERNEL);
if (ad1836 == NULL) if (ad1836 == NULL)
return -ENOMEM; return -ENOMEM;
...@@ -351,17 +352,15 @@ static int __devinit ad1836_spi_probe(struct spi_device *spi) ...@@ -351,17 +352,15 @@ static int __devinit ad1836_spi_probe(struct spi_device *spi)
ret = snd_soc_register_codec(&spi->dev, ret = snd_soc_register_codec(&spi->dev,
&soc_codec_dev_ad1836, &ad183x_dais[ad1836->type], 1); &soc_codec_dev_ad1836, &ad183x_dais[ad1836->type], 1);
if (ret < 0)
kfree(ad1836);
return ret; return ret;
} }
static int __devexit ad1836_spi_remove(struct spi_device *spi) static int __devexit ad1836_spi_remove(struct spi_device *spi)
{ {
snd_soc_unregister_codec(&spi->dev); snd_soc_unregister_codec(&spi->dev);
kfree(spi_get_drvdata(spi));
return 0; return 0;
} }
static const struct spi_device_id ad1836_ids[] = { static const struct spi_device_id ad1836_ids[] = {
{ "ad1835", AD1835 }, { "ad1835", AD1835 },
{ "ad1836", AD1836 }, { "ad1836", AD1836 },
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment