aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs/wm8737.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc/codecs/wm8737.c')
-rw-r--r--sound/soc/codecs/wm8737.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/sound/soc/codecs/wm8737.c b/sound/soc/codecs/wm8737.c
index d0520124616d..8c25442f9b47 100644
--- a/sound/soc/codecs/wm8737.c
+++ b/sound/soc/codecs/wm8737.c
@@ -647,7 +647,8 @@ static __devinit int wm8737_i2c_probe(struct i2c_client *i2c,
647 struct wm8737_priv *wm8737; 647 struct wm8737_priv *wm8737;
648 int ret; 648 int ret;
649 649
650 wm8737 = kzalloc(sizeof(struct wm8737_priv), GFP_KERNEL); 650 wm8737 = devm_kzalloc(&i2c->dev, sizeof(struct wm8737_priv),
651 GFP_KERNEL);
651 if (wm8737 == NULL) 652 if (wm8737 == NULL)
652 return -ENOMEM; 653 return -ENOMEM;
653 654
@@ -656,8 +657,7 @@ static __devinit int wm8737_i2c_probe(struct i2c_client *i2c,
656 657
657 ret = snd_soc_register_codec(&i2c->dev, 658 ret = snd_soc_register_codec(&i2c->dev,
658 &soc_codec_dev_wm8737, &wm8737_dai, 1); 659 &soc_codec_dev_wm8737, &wm8737_dai, 1);
659 if (ret < 0) 660
660 kfree(wm8737);
661 return ret; 661 return ret;
662 662
663} 663}
@@ -665,7 +665,7 @@ static __devinit int wm8737_i2c_probe(struct i2c_client *i2c,
665static __devexit int wm8737_i2c_remove(struct i2c_client *client) 665static __devexit int wm8737_i2c_remove(struct i2c_client *client)
666{ 666{
667 snd_soc_unregister_codec(&client->dev); 667 snd_soc_unregister_codec(&client->dev);
668 kfree(i2c_get_clientdata(client)); 668
669 return 0; 669 return 0;
670} 670}
671 671
@@ -693,7 +693,8 @@ static int __devinit wm8737_spi_probe(struct spi_device *spi)
693 struct wm8737_priv *wm8737; 693 struct wm8737_priv *wm8737;
694 int ret; 694 int ret;
695 695
696 wm8737 = kzalloc(sizeof(struct wm8737_priv), GFP_KERNEL); 696 wm8737 = devm_kzalloc(&spi->dev, sizeof(struct wm8737_priv),
697 GFP_KERNEL);
697 if (wm8737 == NULL) 698 if (wm8737 == NULL)
698 return -ENOMEM; 699 return -ENOMEM;
699 700
@@ -702,15 +703,14 @@ static int __devinit wm8737_spi_probe(struct spi_device *spi)
702 703
703 ret = snd_soc_register_codec(&spi->dev, 704 ret = snd_soc_register_codec(&spi->dev,
704 &soc_codec_dev_wm8737, &wm8737_dai, 1); 705 &soc_codec_dev_wm8737, &wm8737_dai, 1);
705 if (ret < 0) 706
706 kfree(wm8737);
707 return ret; 707 return ret;
708} 708}
709 709
710static int __devexit wm8737_spi_remove(struct spi_device *spi) 710static int __devexit wm8737_spi_remove(struct spi_device *spi)
711{ 711{
712 snd_soc_unregister_codec(&spi->dev); 712 snd_soc_unregister_codec(&spi->dev);
713 kfree(spi_get_drvdata(spi)); 713
714 return 0; 714 return 0;
715} 715}
716 716