Received: by 10.192.165.148 with SMTP id m20csp4174916imm; Mon, 30 Apr 2018 13:12:22 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpjj5RtpS+CGMYTdEx37j8gQNnQg3Nui7YPZhBwge1TNvWDiS7xe1a9DNUSM4VxwiK85yvS X-Received: by 2002:a17:902:33a5:: with SMTP id b34-v6mr13751299plc.232.1525119142707; Mon, 30 Apr 2018 13:12:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525119142; cv=none; d=google.com; s=arc-20160816; b=UWtMq4rMbddNbg32MDra6ts4SDiYHTOYQzuNlAsjwaYRlEPddNbYvcnjuPx39/V939 UHecvcM5s0zP7YYj/s+h7YeLe14rT/XpIhc2Xfa7RnsSsQ3fCEIRR4MXsU5uX18dORCb orMTEjNt9yQPkfya1tqy/frOguxC+KJML6ofhVIqgwVkKd+KtXVoQ89Bn6zVhyiR23z8 hxuRXn9i9zE8P+ssFJz/35a0ybajKUjKsGdG/F44vbpHXIL1JCScNpvyqsjg6FRJ1K/0 mRMAT1QYn2pm2e+9bCnhclHaXkRwf45xHsNy79N/KT7ezpD9mNXEcyFfQySPBs8TQ646 hHHQ== 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=VUh43D/PdK0m6evhnHjUkt8HK0Q0AuvHMOvHyM5HT/k=; b=oNvzDh92rhrlwMe1D7b2JVU6hiz7YaRigochnClrKRHx/cBmFatR2eb/d3ZY1uY+1C nOYXZLRcKvL2SE8BlRH6GeT4DZISzvRZtH7GbMb4aTgcnA1Tr5ITguv/bc5u32QlPBAC ZSNGIFJUBBH96XdaL0vKr6N8HygWmKo9S8TAtH/zNPuxPdBmS/hr7bU1tOEGCs4U0Sjc WN4KTFQ8fwr4jE51Em7KOaLBUnZuLVP2bEXFkrjLRpuoUEVeF8rQPjgM5CdNGT07o0WO hxrPKIkdh/sq4m5EbW7FL3Cdd0hHOBRuBdSTEIfgSz0bvwh8vbs4dYuf75/oZfIS6KcQ 9Y3A== 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 b12-v6si6570331pge.252.2018.04.30.13.12.08; Mon, 30 Apr 2018 13:12:22 -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 S1755906AbeD3T1O (ORCPT + 99 others); Mon, 30 Apr 2018 15:27:14 -0400 Received: from mail.kernel.org ([198.145.29.99]:33408 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755874AbeD3T1M (ORCPT ); Mon, 30 Apr 2018 15:27:12 -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 9A79322DCC; Mon, 30 Apr 2018 19:27:11 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9A79322DCC 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.14 36/91] ALSA: hda - Skip jack and others for non-existing PCM streams Date: Mon, 30 Apr 2018 12:24:18 -0700 Message-Id: <20180430184006.052682115@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180430184004.216234025@linuxfoundation.org> References: <20180430184004.216234025@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.14-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;