diff options
Diffstat (limited to 'sound/soc/codecs/wm2000.c')
-rw-r--r-- | sound/soc/codecs/wm2000.c | 31 |
1 files changed, 13 insertions, 18 deletions
diff --git a/sound/soc/codecs/wm2000.c b/sound/soc/codecs/wm2000.c index c2880907fced..a75c3766aede 100644 --- a/sound/soc/codecs/wm2000.c +++ b/sound/soc/codecs/wm2000.c | |||
@@ -733,8 +733,9 @@ static int __devinit wm2000_i2c_probe(struct i2c_client *i2c, | |||
733 | struct wm2000_priv *wm2000; | 733 | struct wm2000_priv *wm2000; |
734 | struct wm2000_platform_data *pdata; | 734 | struct wm2000_platform_data *pdata; |
735 | const char *filename; | 735 | const char *filename; |
736 | const struct firmware *fw; | 736 | const struct firmware *fw = NULL; |
737 | int reg, ret; | 737 | int ret; |
738 | int reg; | ||
738 | u16 id; | 739 | u16 id; |
739 | 740 | ||
740 | wm2000 = devm_kzalloc(&i2c->dev, sizeof(struct wm2000_priv), | 741 | wm2000 = devm_kzalloc(&i2c->dev, sizeof(struct wm2000_priv), |
@@ -751,7 +752,7 @@ static int __devinit wm2000_i2c_probe(struct i2c_client *i2c, | |||
751 | ret = PTR_ERR(wm2000->regmap); | 752 | ret = PTR_ERR(wm2000->regmap); |
752 | dev_err(&i2c->dev, "Failed to allocate register map: %d\n", | 753 | dev_err(&i2c->dev, "Failed to allocate register map: %d\n", |
753 | ret); | 754 | ret); |
754 | goto err; | 755 | goto out; |
755 | } | 756 | } |
756 | 757 | ||
757 | /* Verify that this is a WM2000 */ | 758 | /* Verify that this is a WM2000 */ |
@@ -763,7 +764,7 @@ static int __devinit wm2000_i2c_probe(struct i2c_client *i2c, | |||
763 | if (id != 0x2000) { | 764 | if (id != 0x2000) { |
764 | dev_err(&i2c->dev, "Device is not a WM2000 - ID %x\n", id); | 765 | dev_err(&i2c->dev, "Device is not a WM2000 - ID %x\n", id); |
765 | ret = -ENODEV; | 766 | ret = -ENODEV; |
766 | goto err_regmap; | 767 | goto out_regmap_exit; |
767 | } | 768 | } |
768 | 769 | ||
769 | reg = wm2000_read(i2c, WM2000_REG_REVISON); | 770 | reg = wm2000_read(i2c, WM2000_REG_REVISON); |
@@ -782,7 +783,7 @@ static int __devinit wm2000_i2c_probe(struct i2c_client *i2c, | |||
782 | ret = request_firmware(&fw, filename, &i2c->dev); | 783 | ret = request_firmware(&fw, filename, &i2c->dev); |
783 | if (ret != 0) { | 784 | if (ret != 0) { |
784 | dev_err(&i2c->dev, "Failed to acquire ANC data: %d\n", ret); | 785 | dev_err(&i2c->dev, "Failed to acquire ANC data: %d\n", ret); |
785 | goto err_regmap; | 786 | goto out_regmap_exit; |
786 | } | 787 | } |
787 | 788 | ||
788 | /* Pre-cook the concatenation of the register address onto the image */ | 789 | /* Pre-cook the concatenation of the register address onto the image */ |
@@ -793,15 +794,13 @@ static int __devinit wm2000_i2c_probe(struct i2c_client *i2c, | |||
793 | if (wm2000->anc_download == NULL) { | 794 | if (wm2000->anc_download == NULL) { |
794 | dev_err(&i2c->dev, "Out of memory\n"); | 795 | dev_err(&i2c->dev, "Out of memory\n"); |
795 | ret = -ENOMEM; | 796 | ret = -ENOMEM; |
796 | goto err_fw; | 797 | goto out_regmap_exit; |
797 | } | 798 | } |
798 | 799 | ||
799 | wm2000->anc_download[0] = 0x80; | 800 | wm2000->anc_download[0] = 0x80; |
800 | wm2000->anc_download[1] = 0x00; | 801 | wm2000->anc_download[1] = 0x00; |
801 | memcpy(wm2000->anc_download + 2, fw->data, fw->size); | 802 | memcpy(wm2000->anc_download + 2, fw->data, fw->size); |
802 | 803 | ||
803 | release_firmware(fw); | ||
804 | |||
805 | wm2000->anc_eng_ena = 1; | 804 | wm2000->anc_eng_ena = 1; |
806 | wm2000->anc_active = 1; | 805 | wm2000->anc_active = 1; |
807 | wm2000->spk_ena = 1; | 806 | wm2000->spk_ena = 1; |
@@ -809,18 +808,14 @@ static int __devinit wm2000_i2c_probe(struct i2c_client *i2c, | |||
809 | 808 | ||
810 | wm2000_reset(wm2000); | 809 | wm2000_reset(wm2000); |
811 | 810 | ||
812 | ret = snd_soc_register_codec(&i2c->dev, &soc_codec_dev_wm2000, | 811 | ret = snd_soc_register_codec(&i2c->dev, &soc_codec_dev_wm2000, NULL, 0); |
813 | NULL, 0); | 812 | if (!ret) |
814 | if (ret != 0) | 813 | goto out; |
815 | goto err_fw; | ||
816 | 814 | ||
817 | return 0; | 815 | out_regmap_exit: |
818 | |||
819 | err_fw: | ||
820 | release_firmware(fw); | ||
821 | err_regmap: | ||
822 | regmap_exit(wm2000->regmap); | 816 | regmap_exit(wm2000->regmap); |
823 | err: | 817 | out: |
818 | release_firmware(fw); | ||
824 | return ret; | 819 | return ret; |
825 | } | 820 | } |
826 | 821 | ||