aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2011-12-03 12:18:37 -0500
committerMark Brown <broonie@opensource.wolfsonmicro.com>2011-12-03 16:35:08 -0500
commit2edaed82b70c22b63bb918e1ca9c34876da21320 (patch)
tree594752d3192afef84286720af5e2929d7c3ecd46
parent5aefb306e35541d35c8d5838ae97f3f9d8ad1a12 (diff)
ASoC: Convert WM8750 to devm_kzalloc()
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
-rw-r--r--sound/soc/codecs/wm8750.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/sound/soc/codecs/wm8750.c b/sound/soc/codecs/wm8750.c
index 48cb78fd0103..fa5732d78225 100644
--- a/sound/soc/codecs/wm8750.c
+++ b/sound/soc/codecs/wm8750.c
@@ -744,7 +744,8 @@ static int __devinit wm8750_spi_probe(struct spi_device *spi)
744 struct wm8750_priv *wm8750; 744 struct wm8750_priv *wm8750;
745 int ret; 745 int ret;
746 746
747 wm8750 = kzalloc(sizeof(struct wm8750_priv), GFP_KERNEL); 747 wm8750 = devm_kzalloc(&spi->dev, sizeof(struct wm8750_priv),
748 GFP_KERNEL);
748 if (wm8750 == NULL) 749 if (wm8750 == NULL)
749 return -ENOMEM; 750 return -ENOMEM;
750 751
@@ -753,15 +754,12 @@ static int __devinit wm8750_spi_probe(struct spi_device *spi)
753 754
754 ret = snd_soc_register_codec(&spi->dev, 755 ret = snd_soc_register_codec(&spi->dev,
755 &soc_codec_dev_wm8750, &wm8750_dai, 1); 756 &soc_codec_dev_wm8750, &wm8750_dai, 1);
756 if (ret < 0)
757 kfree(wm8750);
758 return ret; 757 return ret;
759} 758}
760 759
761static int __devexit wm8750_spi_remove(struct spi_device *spi) 760static int __devexit wm8750_spi_remove(struct spi_device *spi)
762{ 761{
763 snd_soc_unregister_codec(&spi->dev); 762 snd_soc_unregister_codec(&spi->dev);
764 kfree(spi_get_drvdata(spi));
765 return 0; 763 return 0;
766} 764}
767 765
@@ -791,7 +789,8 @@ static __devinit int wm8750_i2c_probe(struct i2c_client *i2c,
791 struct wm8750_priv *wm8750; 789 struct wm8750_priv *wm8750;
792 int ret; 790 int ret;
793 791
794 wm8750 = kzalloc(sizeof(struct wm8750_priv), GFP_KERNEL); 792 wm8750 = devm_kzalloc(&i2c->dev, sizeof(struct wm8750_priv),
793 GFP_KERNEL);
795 if (wm8750 == NULL) 794 if (wm8750 == NULL)
796 return -ENOMEM; 795 return -ENOMEM;
797 796
@@ -800,15 +799,12 @@ static __devinit int wm8750_i2c_probe(struct i2c_client *i2c,
800 799
801 ret = snd_soc_register_codec(&i2c->dev, 800 ret = snd_soc_register_codec(&i2c->dev,
802 &soc_codec_dev_wm8750, &wm8750_dai, 1); 801 &soc_codec_dev_wm8750, &wm8750_dai, 1);
803 if (ret < 0)
804 kfree(wm8750);
805 return ret; 802 return ret;
806} 803}
807 804
808static __devexit int wm8750_i2c_remove(struct i2c_client *client) 805static __devexit int wm8750_i2c_remove(struct i2c_client *client)
809{ 806{
810 snd_soc_unregister_codec(&client->dev); 807 snd_soc_unregister_codec(&client->dev);
811 kfree(i2c_get_clientdata(client));
812 return 0; 808 return 0;
813} 809}
814 810