[alsa-devel] [PATCH 2/5] hda-emu: Quit early if requested codec index is above limit

David Henningsson david.henningsson at canonical.com
Thu Sep 4 14:21:04 CEST 2014


Signed-off-by: David Henningsson <david.henningsson at canonical.com>
---
 hda-parse.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/hda-parse.c b/hda-parse.c
index d9fc311..57e9ee3 100644
--- a/hda-parse.c
+++ b/hda-parse.c
@@ -687,6 +687,11 @@ int parse_codec_proc(FILE *fp, struct xhda_codec *codecp, int codec_index)
 		}
 	}
 
+	if (curidx < codec_index) {
+		hda_log(HDA_LOG_ERR, "Codec index %d requested, but found only %d codecs\n", codec_index, curidx+1);
+		return -ENODEV;
+	}
+
 	add_codec_extensions(codec);
 
 	return 0;
-- 
1.9.1



More information about the Alsa-devel mailing list