aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs/wm9090.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc/codecs/wm9090.c')
-rw-r--r--sound/soc/codecs/wm9090.c20
1 files changed, 6 insertions, 14 deletions
diff --git a/sound/soc/codecs/wm9090.c b/sound/soc/codecs/wm9090.c
index c7ddc56175d1..bb55a70a104a 100644
--- a/sound/soc/codecs/wm9090.c
+++ b/sound/soc/codecs/wm9090.c
@@ -628,7 +628,7 @@ static int wm9090_i2c_probe(struct i2c_client *i2c,
628 return -ENOMEM; 628 return -ENOMEM;
629 } 629 }
630 630
631 wm9090->regmap = regmap_init_i2c(i2c, &wm9090_regmap); 631 wm9090->regmap = devm_regmap_init_i2c(i2c, &wm9090_regmap);
632 if (IS_ERR(wm9090->regmap)) { 632 if (IS_ERR(wm9090->regmap)) {
633 ret = PTR_ERR(wm9090->regmap); 633 ret = PTR_ERR(wm9090->regmap);
634 dev_err(&i2c->dev, "Failed to allocate regmap: %d\n", ret); 634 dev_err(&i2c->dev, "Failed to allocate regmap: %d\n", ret);
@@ -637,16 +637,16 @@ static int wm9090_i2c_probe(struct i2c_client *i2c,
637 637
638 ret = regmap_read(wm9090->regmap, WM9090_SOFTWARE_RESET, &reg); 638 ret = regmap_read(wm9090->regmap, WM9090_SOFTWARE_RESET, &reg);
639 if (ret < 0) 639 if (ret < 0)
640 goto err; 640 return ret;
641
641 if (reg != 0x9093) { 642 if (reg != 0x9093) {
642 dev_err(&i2c->dev, "Device is not a WM9090, ID=%x\n", reg); 643 dev_err(&i2c->dev, "Device is not a WM9090, ID=%x\n", reg);
643 ret = -ENODEV; 644 return -ENODEV;
644 goto err;
645 } 645 }
646 646
647 ret = regmap_write(wm9090->regmap, WM9090_SOFTWARE_RESET, 0); 647 ret = regmap_write(wm9090->regmap, WM9090_SOFTWARE_RESET, 0);
648 if (ret < 0) 648 if (ret < 0)
649 goto err; 649 return ret;
650 650
651 if (i2c->dev.platform_data) 651 if (i2c->dev.platform_data)
652 memcpy(&wm9090->pdata, i2c->dev.platform_data, 652 memcpy(&wm9090->pdata, i2c->dev.platform_data,
@@ -658,23 +658,15 @@ static int wm9090_i2c_probe(struct i2c_client *i2c,
658 &soc_codec_dev_wm9090, NULL, 0); 658 &soc_codec_dev_wm9090, NULL, 0);
659 if (ret != 0) { 659 if (ret != 0) {
660 dev_err(&i2c->dev, "Failed to register CODEC: %d\n", ret); 660 dev_err(&i2c->dev, "Failed to register CODEC: %d\n", ret);
661 goto err; 661 return ret;
662 } 662 }
663 663
664 return 0; 664 return 0;
665
666err:
667 regmap_exit(wm9090->regmap);
668 return ret;
669} 665}
670 666
671static int __devexit wm9090_i2c_remove(struct i2c_client *i2c) 667static int __devexit wm9090_i2c_remove(struct i2c_client *i2c)
672{ 668{
673 struct wm9090_priv *wm9090 = i2c_get_clientdata(i2c);
674
675 snd_soc_unregister_codec(&i2c->dev); 669 snd_soc_unregister_codec(&i2c->dev);
676 regmap_exit(wm9090->regmap);
677
678 return 0; 670 return 0;
679} 671}
680 672