From patchwork Sat Oct 2 14:37:07 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julia Lawall X-Patchwork-Id: 66571 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.180.67]) by ozlabs.org (Postfix) with ESMTP id C34DAB70F0 for ; Sun, 3 Oct 2010 00:37:45 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755735Ab0JBOhL (ORCPT ); Sat, 2 Oct 2010 10:37:11 -0400 Received: from mgw2.diku.dk ([130.225.96.92]:59891 "EHLO mgw2.diku.dk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755710Ab0JBOhK (ORCPT ); Sat, 2 Oct 2010 10:37:10 -0400 Received: from localhost (localhost [127.0.0.1]) by mgw2.diku.dk (Postfix) with ESMTP id 2D7CE19BC4C; Sat, 2 Oct 2010 16:37:09 +0200 (CEST) Received: from mgw2.diku.dk ([127.0.0.1]) by localhost (mgw2.diku.dk [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 21289-16; Sat, 2 Oct 2010 16:37:07 +0200 (CEST) Received: from nhugin.diku.dk (nhugin.diku.dk [130.225.96.140]) by mgw2.diku.dk (Postfix) with ESMTP id BB20D19BC45; Sat, 2 Oct 2010 16:37:07 +0200 (CEST) Received: from ask.diku.dk (ask.diku.dk [130.225.96.225]) by nhugin.diku.dk (Postfix) with ESMTP id 217FD6DF823; Sat, 2 Oct 2010 16:34:27 +0200 (CEST) Received: by ask.diku.dk (Postfix, from userid 3767) id 8E7612084B; Sat, 2 Oct 2010 16:37:07 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by ask.diku.dk (Postfix) with ESMTP id 7AA602015F; Sat, 2 Oct 2010 16:37:07 +0200 (CEST) Date: Sat, 2 Oct 2010 16:37:07 +0200 (CEST) From: Julia Lawall To: walter harms Cc: Chas Williams , kernel-janitors@vger.kernel.org, linux-atm-general@lists.sourceforge.net, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 4/4] drivers/atm/idt77252.c: Remove unnecessary error check In-Reply-To: <4CA73D26.7090109@bfs.de> Message-ID: References: <1286027958-7333-4-git-send-email-julia@diku.dk> <4CA73D26.7090109@bfs.de> MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org This code does not call deinit_card(card); in an error case, as done in other error-handling code in the same function. But actually, the called function init_sram can only return 0, so there is no need for the error check at all. init_sram is also given a void return type, and its single return statement at the end of the function is dropped. A simplified version of the sematic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @r exists@ @r@ statement S1,S2,S3; constant C1,C2,C3; @@ *if (...) {... S1 return -C1;} ... *if (...) {... when != S1 return -C2;} ... *if (...) {... S1 return -C3;} // Signed-off-by: Julia Lawall --- drivers/atm/idt77252.c | 6 ++---- 1 files changed, 2 insertions(+), 4 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/atm/idt77252.c b/drivers/atm/idt77252.c index 1679cbf..bce5732 100644 --- a/drivers/atm/idt77252.c +++ b/drivers/atm/idt77252.c @@ -3152,7 +3152,7 @@ deinit_card(struct idt77252_dev *card) } -static int __devinit +static void __devinit init_sram(struct idt77252_dev *card) { int i; @@ -3298,7 +3298,6 @@ init_sram(struct idt77252_dev *card) SAR_REG_RXFD); IPRINTK("%s: SRAM initialization complete.\n", card->name); - return 0; } static int __devinit @@ -3410,8 +3409,7 @@ init_card(struct atm_dev *dev) writel(readl(SAR_REG_CFG) | conf, SAR_REG_CFG); - if (init_sram(card) < 0) - return -1; + init_sram(card); /********************************************************************/ /* A L L O C R A M A N D S E T V A R I O U S T H I N G S */