From: Takashi Iwai Subject: Re: [PATCH 6/9] ASoC: max98095: Add missing negative channel checks Date: Wed, 30 Oct 2013 18:36:21 +0100 Message-ID: References: <1383118507-21503-1-git-send-email-tiwai@suse.de> <1383118507-21503-7-git-send-email-tiwai@suse.de> <20131030164653.GG2493@sirena.org.uk> 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 C6AFD2617B6 for ; Wed, 30 Oct 2013 18:36:21 +0100 (CET) In-Reply-To: <20131030164653.GG2493@sirena.org.uk> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org To: Mark Brown Cc: alsa-devel@alsa-project.org, Liam Girdwood List-Id: alsa-devel@alsa-project.org At Wed, 30 Oct 2013 09:46:53 -0700, Mark Brown wrote: > > On Wed, Oct 30, 2013 at 08:35:04AM +0100, Takashi Iwai wrote: > > > + if (channel < 0) > > + return channel; > > BUG_ON(channel > 1); > > This doesn't seem to fit in well with the adjacent code - the handling > of out of bounds data isn't consistent though it looks like they're both > doing essentially the same thing here. Actually BUG_ON(channel > 1) is a pretty stupid line and should be removed. You'll see that this never happens if you read the code. Overall, this driver has way too many BUG_ON() without considerations. Such BUT_ON()'s are worse than nothing, IMO. Takashi