Received: by 10.192.165.148 with SMTP id m20csp4147651imm; Mon, 30 Apr 2018 12:39:25 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrEiYHwJP6K5JbVY4xUGiiAGhhh6PifQIaPI7PCtXsRnJSTcQIPpEfH/ekIAB5w9on+VxNI X-Received: by 2002:a17:902:7146:: with SMTP id u6-v6mr13339517plm.289.1525117165657; Mon, 30 Apr 2018 12:39:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525117165; cv=none; d=google.com; s=arc-20160816; b=eUno9o2Dbn8kHPTzT5/jZD3h2n4iXNciXhmQTSjWhsUUXFgQIEGtlEzIix90Q3ZwgW TQd9c4S3LNNCJQvae2nibuRgyu+svs3mqMBX2Xu8suby0/CjlaA0ms1sK0Y74HSrDK+G D0JOhfqtstY08nuBzyQcIeFd+rJn2gz/YZDns+bVFqRw4ugJjKRu9MsmF2P0Us9bsETP 6WapoXLgBqQvxbgHwn7tNeieYkwq2L1DdNER/uji3DZf3t/8bIecZ7rfVnk7YVPm+/eG +4KQPb+60FAwKG5D0SWZgbmEmnfOLu+HQ8cfFHTx6Lewh5cF4wGZmt+Z93A01Axdv6VK QxsQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from:dmarc-filter :arc-authentication-results; bh=R3mi5XvdJA7gY6pFdbGFxau0/VcntJFKth7cPcIIfGc=; b=vhLXsPegFnDASVp2pkyMi84dwSWsvdcyMafiXSEybBTQ7tCidYVYlZrv1VKe9bTjS1 OOBaD4a+Mi5x0LGsUdy0QE/8Tu98Pq9vQnrtjTs3GMlZjWq5sacYV3JfevMh27sOdq93 hbl603cL0IWKLEfEu6l+/c12ShtjVrPgPMcHE7Jl6enpo4vNK3IHd9VcYrup+Mbm0m+A vj4luP0iQers3a12Qo0tj0dCyVv9SBzno7I3OL12wUiGDNLpuLay0Nv/2zz7p1hU1oOk 4B23pHG8/BWO7RN6tqsEnuTGEHnw//WrR+Jb3cDKQ77OUI+cpTXlaQkbHL9YbSyDGj53 XLlQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t2-v6si8026086plz.27.2018.04.30.12.39.10; Mon, 30 Apr 2018 12:39:25 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756365AbeD3T2h (ORCPT + 99 others); Mon, 30 Apr 2018 15:28:37 -0400 Received: from mail.kernel.org ([198.145.29.99]:36454 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932307AbeD3T2e (ORCPT ); Mon, 30 Apr 2018 15:28:34 -0400 Received: from localhost (unknown [104.132.1.102]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 4FCED22DBF; Mon, 30 Apr 2018 19:28:34 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4FCED22DBF Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linuxfoundation.org Authentication-Results: mail.kernel.org; spf=fail smtp.mailfrom=gregkh@linuxfoundation.org From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Takashi Iwai Subject: [PATCH 4.16 040/113] ALSA: hda - Skip jack and others for non-existing PCM streams Date: Mon, 30 Apr 2018 12:24:11 -0700 Message-Id: <20180430184016.748520325@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180430184015.043892819@linuxfoundation.org> References: <20180430184015.043892819@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.16-stable review patch. If anyone has any objections, please let me know. ------------------ From: Takashi Iwai commit 8a7d6003df41cb16f6b3b620da044fbd92d2f5ee upstream. When CONFIG_SND_DYNAMIC_MINORS isn't set, there are only limited number of devices available, and HD-audio, especially with HDMI/DP codec, will fail to create more than two devices. The driver warns about the lack of such devices and skips the PCM device creations, but the HDMI driver still tries to create the corresponding JACK, SPDIF and ELD controls even for the non-existing PCM substreams. This results in confusion on user-space, and even may break the operation. Similarly, Intel HDMI/DP codec builds the ELD notification from i915 graphics driver, and this may be broken if a notification is sent for the non-existing PCM stream. This patch adds the check of the existence of the assigned PCM substream in the both scenarios above, and skips the further operation if the PCM substream is not assigned. Fixes: 9152085defb6 ("ALSA: hda - add DP MST audio support") Cc: Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman --- sound/pci/hda/patch_hdmi.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) --- a/sound/pci/hda/patch_hdmi.c +++ b/sound/pci/hda/patch_hdmi.c @@ -1383,6 +1383,8 @@ static void hdmi_pcm_setup_pin(struct hd pcm = get_pcm_rec(spec, per_pin->pcm_idx); else return; + if (!pcm->pcm) + return; if (!test_bit(per_pin->pcm_idx, &spec->pcm_in_use)) return; @@ -2151,8 +2153,13 @@ static int generic_hdmi_build_controls(s int dev, err; int pin_idx, pcm_idx; - for (pcm_idx = 0; pcm_idx < spec->pcm_used; pcm_idx++) { + if (!get_pcm_rec(spec, pcm_idx)->pcm) { + /* no PCM: mark this for skipping permanently */ + set_bit(pcm_idx, &spec->pcm_bitmap); + continue; + } + err = generic_hdmi_build_jack(codec, pcm_idx); if (err < 0) return err;