aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2012-01-21 18:25:16 -0500
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-01-21 18:28:22 -0500
commit82fa3670575143031517531936b1cc308d4981fa (patch)
tree73d30ecf4cc57e272d9b3c63b63f19ebd331384c
parentdd21353f35082fa77d1c8672fffebf324954eb09 (diff)
ASoC: wm8988: Convert to devm_kzalloc()
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
-rw-r--r--sound/soc/codecs/wm8988.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/sound/soc/codecs/wm8988.c b/sound/soc/codecs/wm8988.c
index 40aebafb35e6..4ef9d4cb7d7c 100644
--- a/sound/soc/codecs/wm8988.c
+++ b/sound/soc/codecs/wm8988.c
@@ -799,7 +799,8 @@ static int __devinit wm8988_spi_probe(struct spi_device *spi)
799 struct wm8988_priv *wm8988; 799 struct wm8988_priv *wm8988;
800 int ret; 800 int ret;
801 801
802 wm8988 = kzalloc(sizeof(struct wm8988_priv), GFP_KERNEL); 802 wm8988 = devm_kzalloc(&spi->dev, sizeof(struct wm8988_priv),
803 GFP_KERNEL);
803 if (wm8988 == NULL) 804 if (wm8988 == NULL)
804 return -ENOMEM; 805 return -ENOMEM;
805 806
@@ -808,15 +809,13 @@ static int __devinit wm8988_spi_probe(struct spi_device *spi)
808 809
809 ret = snd_soc_register_codec(&spi->dev, 810 ret = snd_soc_register_codec(&spi->dev,
810 &soc_codec_dev_wm8988, &wm8988_dai, 1); 811 &soc_codec_dev_wm8988, &wm8988_dai, 1);
811 if (ret < 0) 812
812 kfree(wm8988);
813 return ret; 813 return ret;
814} 814}
815 815
816static int __devexit wm8988_spi_remove(struct spi_device *spi) 816static int __devexit wm8988_spi_remove(struct spi_device *spi)
817{ 817{
818 snd_soc_unregister_codec(&spi->dev); 818 snd_soc_unregister_codec(&spi->dev);
819 kfree(spi_get_drvdata(spi));
820 return 0; 819 return 0;
821} 820}
822 821
@@ -837,7 +836,8 @@ static __devinit int wm8988_i2c_probe(struct i2c_client *i2c,
837 struct wm8988_priv *wm8988; 836 struct wm8988_priv *wm8988;
838 int ret; 837 int ret;
839 838
840 wm8988 = kzalloc(sizeof(struct wm8988_priv), GFP_KERNEL); 839 wm8988 = devm_kzalloc(&i2c->dev, sizeof(struct wm8988_priv),
840 GFP_KERNEL);
841 if (wm8988 == NULL) 841 if (wm8988 == NULL)
842 return -ENOMEM; 842 return -ENOMEM;
843 843
@@ -846,15 +846,12 @@ static __devinit int wm8988_i2c_probe(struct i2c_client *i2c,
846 846
847 ret = snd_soc_register_codec(&i2c->dev, 847 ret = snd_soc_register_codec(&i2c->dev,
848 &soc_codec_dev_wm8988, &wm8988_dai, 1); 848 &soc_codec_dev_wm8988, &wm8988_dai, 1);
849 if (ret < 0)
850 kfree(wm8988);
851 return ret; 849 return ret;
852} 850}
853 851
854static __devexit int wm8988_i2c_remove(struct i2c_client *client) 852static __devexit int wm8988_i2c_remove(struct i2c_client *client)
855{ 853{
856 snd_soc_unregister_codec(&client->dev); 854 snd_soc_unregister_codec(&client->dev);
857 kfree(i2c_get_clientdata(client));
858 return 0; 855 return 0;
859} 856}
860 857