aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs/ssm2602.c
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@gmail.com>2011-12-28 23:05:20 -0500
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-01-02 07:28:12 -0500
commit8eeffe9891dbb74aedcb9a82da4733961d7b432f (patch)
tree97240d5bc470cd7a276ac35504dac882c6a4aaa1 /sound/soc/codecs/ssm2602.c
parenta92b0a0803a40f91689fa479b7a169d0467ba33f (diff)
ASoC: Convert ssm2602 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/ssm2602.c')
-rw-r--r--sound/soc/codecs/ssm2602.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/sound/soc/codecs/ssm2602.c b/sound/soc/codecs/ssm2602.c
index 7dfc7b08114c..333dd98af39c 100644
--- a/sound/soc/codecs/ssm2602.c
+++ b/sound/soc/codecs/ssm2602.c
@@ -652,7 +652,8 @@ static int __devinit ssm2602_spi_probe(struct spi_device *spi)
652 struct ssm2602_priv *ssm2602; 652 struct ssm2602_priv *ssm2602;
653 int ret; 653 int ret;
654 654
655 ssm2602 = kzalloc(sizeof(struct ssm2602_priv), GFP_KERNEL); 655 ssm2602 = devm_kzalloc(&spi->dev, sizeof(struct ssm2602_priv),
656 GFP_KERNEL);
656 if (ssm2602 == NULL) 657 if (ssm2602 == NULL)
657 return -ENOMEM; 658 return -ENOMEM;
658 659
@@ -662,15 +663,12 @@ static int __devinit ssm2602_spi_probe(struct spi_device *spi)
662 663
663 ret = snd_soc_register_codec(&spi->dev, 664 ret = snd_soc_register_codec(&spi->dev,
664 &soc_codec_dev_ssm2602, &ssm2602_dai, 1); 665 &soc_codec_dev_ssm2602, &ssm2602_dai, 1);
665 if (ret < 0)
666 kfree(ssm2602);
667 return ret; 666 return ret;
668} 667}
669 668
670static int __devexit ssm2602_spi_remove(struct spi_device *spi) 669static int __devexit ssm2602_spi_remove(struct spi_device *spi)
671{ 670{
672 snd_soc_unregister_codec(&spi->dev); 671 snd_soc_unregister_codec(&spi->dev);
673 kfree(spi_get_drvdata(spi));
674 return 0; 672 return 0;
675} 673}
676 674
@@ -697,7 +695,8 @@ static int __devinit ssm2602_i2c_probe(struct i2c_client *i2c,
697 struct ssm2602_priv *ssm2602; 695 struct ssm2602_priv *ssm2602;
698 int ret; 696 int ret;
699 697
700 ssm2602 = kzalloc(sizeof(struct ssm2602_priv), GFP_KERNEL); 698 ssm2602 = devm_kzalloc(&i2c->dev, sizeof(struct ssm2602_priv),
699 GFP_KERNEL);
701 if (ssm2602 == NULL) 700 if (ssm2602 == NULL)
702 return -ENOMEM; 701 return -ENOMEM;
703 702
@@ -707,15 +706,12 @@ static int __devinit ssm2602_i2c_probe(struct i2c_client *i2c,
707 706
708 ret = snd_soc_register_codec(&i2c->dev, 707 ret = snd_soc_register_codec(&i2c->dev,
709 &soc_codec_dev_ssm2602, &ssm2602_dai, 1); 708 &soc_codec_dev_ssm2602, &ssm2602_dai, 1);
710 if (ret < 0)
711 kfree(ssm2602);
712 return ret; 709 return ret;
713} 710}
714 711
715static int __devexit ssm2602_i2c_remove(struct i2c_client *client) 712static int __devexit ssm2602_i2c_remove(struct i2c_client *client)
716{ 713{
717 snd_soc_unregister_codec(&client->dev); 714 snd_soc_unregister_codec(&client->dev);
718 kfree(i2c_get_clientdata(client));
719 return 0; 715 return 0;
720} 716}
721 717