[alsa-devel] [PATCH 2/3] ALSA: hda - Immediately fail if the i915 audio component is disabled

Takashi Iwai tiwai at suse.de
Thu Apr 7 12:57:23 CEST 2016


Since i915 notifies its disabled state via the stub component binding,
we can bail out immediately once when the disabled flag is detected.

Based on the original patch by Imre Deak <imre.deak at intel.com>

Signed-off-by: Takashi Iwai <tiwai at suse.de>
---
 sound/hda/hdac_i915.c | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/sound/hda/hdac_i915.c b/sound/hda/hdac_i915.c
index 6800e0c5a38f..812777f9af1f 100644
--- a/sound/hda/hdac_i915.c
+++ b/sound/hda/hdac_i915.c
@@ -223,8 +223,18 @@ static int hdac_component_master_bind(struct device *dev)
 	if (ret < 0)
 		return ret;
 
-	if (WARN_ON(!(acomp->dev && acomp->ops && acomp->ops->get_power &&
-		      acomp->ops->put_power && acomp->ops->get_cdclk_freq))) {
+	if (WARN_ON(!(acomp->dev && acomp->ops))) {
+		ret = -EINVAL;
+		goto out_unbind;
+	}
+
+	if (acomp->ops->disabled) {
+		ret = -ENODEV;
+		goto out_unbind;
+	}
+
+	if (WARN_ON(!(acomp->ops->get_power && acomp->ops->put_power &&
+		      acomp->ops->get_cdclk_freq))) {
 		ret = -EINVAL;
 		goto out_unbind;
 	}
@@ -342,7 +352,7 @@ int snd_hdac_i915_init(struct hdac_bus *bus)
 	 */
 	request_module("i915");
 
-	if (!acomp->ops) {
+	if (!acomp->ops || acomp->ops->disabled) {
 		ret = -ENODEV;
 		goto out_master_del;
 	}
-- 
2.8.1



More information about the Alsa-devel mailing list