Skip to contentSkip to conversation

ASoC: ad1980: Return proper error if vendor id mismatch

PATCH Applied Axel Lin 3 participants 3 messages Sep 6, 2011 – Sep 8, 2011

Subsystems (3)
lore
Share & tools
lore

Axel Lin

author
#0 lore raw

PATCH 1/1 ASoC: ad1980: Return proper error if vendor id mismatch

Return -ENODEV instead of 0 if vendor id mismatch.

---
 sound/soc/codecs/ad1980.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)
sound/soc/codecs/ad1980.c +7 -3
index 923b364..4c0fc30 100644
@@ -200,18 +200,22 @@ static int ad1980_soc_probe(struct snd_soc_codec *codec)
 	}
 
 	/* Read out vendor ID to make sure it is ad1980 */
-	if (ac97_read(codec, AC97_VENDOR_ID1) != 0x4144)
+	if (ac97_read(codec, AC97_VENDOR_ID1) != 0x4144) {
+		ret = -ENODEV;
 		goto reset_err;
+	}
 
 	vendor_id2 = ac97_read(codec, AC97_VENDOR_ID2);
 
 	if (vendor_id2 != 0x5370) {
-		if (vendor_id2 != 0x5374)
+		if (vendor_id2 != 0x5374) {
+			ret = -ENODEV;
 			goto reset_err;
-		else
+		} else {
 			printk(KERN_WARNING "ad1980: "
 				"Found AD1981 - only 2/2 IN/OUT Channels "
 				"supported\n");
+		}
 	}
 
 	/* unmute captures and playbacks volume */
Signature · 1 line
1.7.4.1
#1 lore raw
Quoted 38 lines · Axel Lin

Return -ENODEV instead of 0 if vendor id mismatch.

---
 sound/soc/codecs/ad1980.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)
sound/soc/codecs/ad1980.c +7 -3
index 923b364..4c0fc30 100644
@@ -200,18 +200,22 @@ static int ad1980_soc_probe(struct snd_soc_codec
 *codec)
       }
 
       /* Read out vendor ID to make sure it is ad1980 */
-       if (ac97_read(codec, AC97_VENDOR_ID1) != 0x4144)
+       if (ac97_read(codec, AC97_VENDOR_ID1) != 0x4144) {
+               ret = -ENODEV;
               goto reset_err;
+       }
 
       vendor_id2 = ac97_read(codec, AC97_VENDOR_ID2);
 
       if (vendor_id2 != 0x5370) {
-               if (vendor_id2 != 0x5374)
+               if (vendor_id2 != 0x5374) {
+                       ret = -ENODEV;
                       goto reset_err;
-               else
+               } else {
                       printk(KERN_WARNING "ad1980: "
                               "Found AD1981 - only 2/2 IN/OUT Channels "
                               "supported\n");
+               }
       }
 
       /* unmute captures and playbacks volume */
Quoted 6 lines

--
1.7.4.1

Acked-by Liam Girdwood <[email protected]>