From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1762203AbYBVRoA (ORCPT ); Fri, 22 Feb 2008 12:44:00 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754017AbYBVRnw (ORCPT ); Fri, 22 Feb 2008 12:43:52 -0500 Received: from mx1.suse.de ([195.135.220.2]:57464 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756132AbYBVRnv (ORCPT ); Fri, 22 Feb 2008 12:43:51 -0500 Date: Fri, 22 Feb 2008 18:43:50 +0100 Message-ID: From: Takashi Iwai To: torvalds@linux-foundation.org Cc: linux-kernel@vger.kernel.org, akpm@linux-foundation.org Subject: [PATCH 10/16] [ALSA] hda-codec - Don't create vmaster if no slaves found In-Reply-To: References: User-Agent: Wanderlust/2.15.5 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.7 (=?ISO-8859-4?Q?Sanj=F2?=) APEL/10.6 MULE XEmacs/21.5 (beta28) (fuki) (+CVS-20070806) (i386-suse-linux) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Don't create vmaster controls if no slaves are found in the given list. This prevents the error due to an empty vmaster control. Signed-off-by: Takashi Iwai --- sound/pci/hda/hda_codec.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-) diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index 5c6419e..37c4139 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c @@ -1055,6 +1055,12 @@ int snd_hda_add_vmaster(struct hda_codec *codec, char *name, const char **s; int err; + for (s = slaves; *s && !snd_hda_find_mixer_ctl(codec, *s); s++) + ; + if (!*s) { + snd_printdd("No slave found for %s\n", name); + return 0; + } kctl = snd_ctl_make_virtual_master(name, tlv); if (!kctl) return -ENOMEM; -- 1.5.3.8