From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stanislaw Gruszka Subject: Re: [PATCH 6/15] drivers/net/wireless/iwlegacy/4965-mac.c: adjust duplicate test Date: Mon, 21 Jan 2013 13:07:20 +0100 Message-ID: <20130121120719.GB5424@redhat.com> References: <1358773378-4700-1-git-send-email-Julia.Lawall@lip6.fr> <1358773378-4700-7-git-send-email-Julia.Lawall@lip6.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: kernel-janitors@vger.kernel.org, "John W. Linville" , linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org To: Julia Lawall Return-path: Content-Disposition: inline In-Reply-To: <1358773378-4700-7-git-send-email-Julia.Lawall@lip6.fr> Sender: linux-kernel-owner@vger.kernel.org List-Id: netdev.vger.kernel.org On Mon, Jan 21, 2013 at 02:02:50PM +0100, Julia Lawall wrote: > From: Julia Lawall > > Delete successive tests to the same location. This looks like simple code > duplication. > > A simplified version of the semantic match that finds this problem is as > follows: (http://coccinelle.lip6.fr/) > > // > @s exists@ > local idexpression y; > expression x,e; > @@ > > *if ( \(x == NULL\|IS_ERR(x)\|y != 0\) ) > { ... when forall > return ...; } > ... when != \(y = e\|y += e\|y -= e\|y |= e\|y &= e\|y++\|y--\|&y\) > when != \(XT_GETPAGE(...,y)\|WMI_CMD_BUF(...)\) > *if ( \(x == NULL\|IS_ERR(x)\|y != 0\) ) > { ... when forall > return ...; } > // > > Signed-off-by: Julia Lawall ACK