From patchwork Sun Dec 21 15:37:36 2008 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julia Lawall X-Patchwork-Id: 15149 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by ozlabs.org (Postfix) with ESMTP id 060C5DDE0A for ; Mon, 22 Dec 2008 02:37:50 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754682AbYLUPhn (ORCPT ); Sun, 21 Dec 2008 10:37:43 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754114AbYLUPhl (ORCPT ); Sun, 21 Dec 2008 10:37:41 -0500 Received: from mgw1.diku.dk ([130.225.96.91]:56112 "EHLO mgw1.diku.dk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752441AbYLUPhk (ORCPT ); Sun, 21 Dec 2008 10:37:40 -0500 Received: from localhost (localhost [127.0.0.1]) by mgw1.diku.dk (Postfix) with ESMTP id E839852C331; Sun, 21 Dec 2008 16:37:38 +0100 (CET) X-Virus-Scanned: amavisd-new at diku.dk Received: from mgw1.diku.dk ([127.0.0.1]) by localhost (mgw1.diku.dk [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id GD-J0yYQC9qm; Sun, 21 Dec 2008 16:37:37 +0100 (CET) Received: from nhugin.diku.dk (nhugin.diku.dk [130.225.96.140]) by mgw1.diku.dk (Postfix) with ESMTP id 0F08752C35D; Sun, 21 Dec 2008 16:37:37 +0100 (CET) Received: from pc-004.diku.dk (pc-004.diku.dk [130.225.97.4]) by nhugin.diku.dk (Postfix) with ESMTP id 64FF46DF823; Sun, 21 Dec 2008 16:37:02 +0100 (CET) Received: by pc-004.diku.dk (Postfix, from userid 3767) id E62C79C591; Sun, 21 Dec 2008 16:37:36 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by pc-004.diku.dk (Postfix) with ESMTP id E569F9C532; Sun, 21 Dec 2008 16:37:36 +0100 (CET) Date: Sun, 21 Dec 2008 16:37:36 +0100 (CET) From: Julia Lawall To: manuel.lauss@gmail.com, jgarzik@pobox.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH 4/13] drivers/net/au1000_eth.c: Remove redundant test Message-ID: MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Julia Lawall phydev is checked to be not NULL a few lines above. A simplified version of the semantic patch that makes this change is as follows: (http://www.emn.fr/x-info/coccinelle/) // @r exists@ local idexpression x; expression E; position p1,p2; @@ if (x@p1 == NULL || ...) { ... when forall return ...; } ... when != \(x=E\|x--\|x++\|--x\|++x\|x-=E\|x+=E\|x|=E\|x&=E\|&x\) ( x@p2 == NULL | x@p2 != NULL ) // another path to the test that is not through p1? @s exists@ local idexpression r.x; position r.p1,r.p2; @@ ... when != x@p1 ( x@p2 == NULL | x@p2 != NULL ) @fix depends on !s@ position r.p1,r.p2; expression x,E; statement S1,S2; @@ ( - if ((x@p2 != NULL) || ...) S1 | - if ((x@p2 == NULL) && ...) S1 | - BUG_ON(x@p2 == NULL); ) // Signed-off-by: Julia Lawall --- drivers/net/au1000_eth.c | 1 - 1 files changed, 0 insertions(+), 1 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/net/au1000_eth.c b/drivers/net/au1000_eth.c index ecc2573..9c875bb 100644 --- a/drivers/net/au1000_eth.c +++ b/drivers/net/au1000_eth.c @@ -353,7 +353,6 @@ static int mii_probe (struct net_device *dev) } /* now we are supposed to have a proper phydev, to attach to... */ - BUG_ON(!phydev); BUG_ON(phydev->attached_dev); phydev = phy_connect(dev, phydev->dev.bus_id, &au1000_adjust_link, 0,