From: Takashi Iwai Subject: Re: [PATCH 2/3] ALSA: core: release the constraint check for replace ops Date: Wed, 24 Aug 2011 08:01:08 +0200 Message-ID: References: <20110824031234.5279.46501.stgit@localhost6.localdomain6> <20110824031239.5279.97696.stgit@localhost6.localdomain6> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mx2.suse.de (cantor2.suse.de [195.135.220.15]) by alsa0.perex.cz (Postfix) with ESMTP id 33A3C24665 for ; Wed, 24 Aug 2011 08:01:09 +0200 (CEST) In-Reply-To: <20110824031239.5279.97696.stgit@localhost6.localdomain6> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: alsa-devel-bounces@alsa-project.org Errors-To: alsa-devel-bounces@alsa-project.org To: Lu Guanqun Cc: ALSA , clemens@ladisch.de List-Id: alsa-devel@alsa-project.org At Wed, 24 Aug 2011 11:12:39 +0800, Lu Guanqun wrote: > > Suppose the ALSA card already has a number of MAX_USER_CONTROLS controls, and > the user wants to replace one, it should not fail at this condition check. It'd be simpler to ignore the check when replace flag is set? The proposed change here looks too tricky, IMO... thanks, Takashi > Signed-off-by: Lu Guanqun > --- > sound/core/control.c | 2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) > > diff --git a/sound/core/control.c b/sound/core/control.c > index 7f2b3a7..98b7fc7 100644 > --- a/sound/core/control.c > +++ b/sound/core/control.c > @@ -1073,7 +1073,7 @@ static int snd_ctl_elem_add(struct snd_ctl_file *file, > struct user_element *ue; > int idx, err; > > - if (card->user_ctl_count >= MAX_USER_CONTROLS) > + if (card->user_ctl_count >= MAX_USER_CONTROLS + !!replace) > return -ENOMEM; > if (info->count < 1) > return -EINVAL; >