From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752490AbYBROBU (ORCPT ); Mon, 18 Feb 2008 09:01:20 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751382AbYBROBI (ORCPT ); Mon, 18 Feb 2008 09:01:08 -0500 Received: from ns.suse.de ([195.135.220.2]:49392 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751348AbYBROBH (ORCPT ); Mon, 18 Feb 2008 09:01:07 -0500 Date: Mon, 18 Feb 2008 15:01:04 +0100 Message-ID: From: Takashi Iwai To: Julia Lawall Cc: perex@suse.cz, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: Re: [PATCH 6/7] sound: Use BUG_ON 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 At Sun, 17 Feb 2008 18:57:30 +0100 (CET), Julia Lawall wrote: > > From: Julia Lawall > > if (...) BUG(); should be replaced with BUG_ON(...) when the test has no > side-effects to allow a definition of BUG_ON that drops the code completely. > > The semantic patch that makes this change is as follows: > (http://www.emn.fr/x-info/coccinelle/) > > // > @ disable unlikely @ expression E,f; @@ > > ( > if (<... f(...) ...>) { BUG(); } > | > - if (unlikely(E)) { BUG(); } > + BUG_ON(E); > ) > > @@ expression E,f; @@ > > ( > if (<... f(...) ...>) { BUG(); } > | > - if (E) { BUG(); } > + BUG_ON(E); > ) > // > > Signed-off-by: Julia Lawall > > --- > > diff -u -p a/sound/core/seq/oss/seq_oss_synth.c b/sound/core/seq/oss/seq_oss_synth.c > --- a/sound/core/seq/oss/seq_oss_synth.c 2006-11-30 19:05:47.000000000 +0100 > +++ b/sound/core/seq/oss/seq_oss_synth.c 2008-02-17 16:43:24.000000000 +0100 > @@ -245,8 +245,7 @@ snd_seq_oss_synth_setup(struct seq_oss_d > info->nr_voices = rec->nr_voices; > if (info->nr_voices > 0) { > info->ch = kcalloc(info->nr_voices, sizeof(struct seq_oss_chinfo), GFP_KERNEL); > - if (!info->ch) > - BUG(); > + BUG_ON(!info->ch); Actually this shouldn't be BUG() but do error-processing properly... Will fix this later. thanks, Takashi