Blob Blame History Raw
From 17890880bbf7bac8171054c7dca7a5162b23c5c2 Mon Sep 17 00:00:00 2001
From: Takashi Iwai <tiwai@suse.de>
Date: Wed, 28 Jun 2017 12:45:34 +0200
Subject: [PATCH] ALSA: hda - Skip card registration when no codec is found
Git-commit: 17890880bbf7bac8171054c7dca7a5162b23c5c2
Patch-mainline: v4.13-rc1
References: bsc#1052235

It's nonsense to register a card object when no codec is bound on it,
as we don't support the deferred codec binding.  Instead of
registering an empty card object, just skip the registration by
returning an error from azx_codec_configure().

Signed-off-by: Takashi Iwai <tiwai@suse.de>

---
 sound/pci/hda/hda_controller.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/sound/pci/hda/hda_controller.c b/sound/pci/hda/hda_controller.c
index 1c60beb5b70a..d1eb14842340 100644
--- a/sound/pci/hda/hda_controller.c
+++ b/sound/pci/hda/hda_controller.c
@@ -1345,6 +1345,9 @@ int azx_codec_configure(struct azx *chip)
 	list_for_each_codec_safe(codec, next, &chip->bus) {
 		snd_hda_codec_configure(codec);
 	}
+
+	if (!azx_bus(chip)->num_codecs)
+		return -ENODEV;
 	return 0;
 }
 EXPORT_SYMBOL_GPL(azx_codec_configure);
-- 
2.16.1