From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752971AbdICNzT (ORCPT ); Sun, 3 Sep 2017 09:55:19 -0400 Received: from mail-pf0-f194.google.com ([209.85.192.194]:33260 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752840AbdICNzS (ORCPT ); Sun, 3 Sep 2017 09:55:18 -0400 X-Google-Smtp-Source: ADKCNb6NwG/wKUlCzxpDVQzD1zaiH49r60VhsXOjRCJcjS6HkG1nGmv2kGFDj+VWgZl1BgXYJHsoXw== Date: Sun, 3 Sep 2017 21:52:31 +0800 From: Wang YanQing To: tiwai@suse.de Cc: alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, fengguang.wu@intel.com Subject: [PATCH] ALSA: hda: Fix assign invalid fixed slots pcm numbers to HDA_PCM_TYPE_HDMI in get_empty_pcm_device Message-ID: <20170903135231.GB2278@udknight> Mail-Followup-To: Wang YanQing , tiwai@suse.de, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, fengguang.wu@intel.com MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.7.1 (2016-10-04) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The length of pcm_dev_bits in hda_bus is SNDRV_PCM_DEVICES, and the definiton of SNDRV_PCM_DEVICES is: " #if defined(CONFIG_SND_DYNAMIC_MINORS) #define SNDRV_PCM_DEVICES (SNDRV_OS_MINORS-2) #else #define SNDRV_PCM_DEVICES 8 #endif " So the max valid fixed slots pcm number is 7, and the first non-fixed slot is 8. Signed-off-by: Wang YanQing --- sound/pci/hda/hda_codec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index 3db26c4..df6b57e 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c @@ -3118,7 +3118,7 @@ static int get_empty_pcm_device(struct hda_bus *bus, unsigned int type) static int audio_idx[HDA_PCM_NTYPES][5] = { [HDA_PCM_TYPE_AUDIO] = { 0, 2, 4, 5, -1 }, [HDA_PCM_TYPE_SPDIF] = { 1, -1 }, - [HDA_PCM_TYPE_HDMI] = { 3, 7, 8, 9, -1 }, + [HDA_PCM_TYPE_HDMI] = { 3, 7, -1 }, [HDA_PCM_TYPE_MODEM] = { 6, -1 }, }; int i; @@ -3139,7 +3139,7 @@ static int get_empty_pcm_device(struct hda_bus *bus, unsigned int type) #ifdef CONFIG_SND_DYNAMIC_MINORS /* non-fixed slots starting from 10 */ - for (i = 10; i < 32; i++) { + for (i = 8; i < 32; i++) { if (!test_and_set_bit(i, bus->pcm_dev_bits)) return i; } -- 1.8.5.6.2.g3d8a54e.dirty