From patchwork Sat Oct 2 13:59:18 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julia Lawall X-Patchwork-Id: 66570 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 C5F44B70EF for ; Sat, 2 Oct 2010 23:55:55 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932141Ab0JBNzA (ORCPT ); Sat, 2 Oct 2010 09:55:00 -0400 Received: from mgw2.diku.dk ([130.225.96.92]:52939 "EHLO mgw2.diku.dk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755548Ab0JBNy7 (ORCPT ); Sat, 2 Oct 2010 09:54:59 -0400 Received: from localhost (localhost [127.0.0.1]) by mgw2.diku.dk (Postfix) with ESMTP id C3BE319BC54; Sat, 2 Oct 2010 15:54:57 +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 20008-20; Sat, 2 Oct 2010 15:54:56 +0200 (CEST) Received: from palace.topps.diku.dk (palace.ekstranet.diku.dk [192.38.115.202]) by mgw2.diku.dk (Postfix) with ESMTP id A6EF519BC57; Sat, 2 Oct 2010 15:54:54 +0200 (CEST) From: Julia Lawall To: Chas Williams Cc: kernel-janitors@vger.kernel.org, linux-atm-general@lists.sourceforge.net, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 4/4] drivers/atm/idt77252.c: Remove unnecessary error check Date: Sat, 2 Oct 2010 15:59:18 +0200 Message-Id: <1286027958-7333-4-git-send-email-julia@diku.dk> X-Mailer: git-send-email 1.7.1 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. 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 | 3 +-- 1 file changed, 1 insertion(+), 2 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..08ccde6 100644 --- a/drivers/atm/idt77252.c +++ b/drivers/atm/idt77252.c @@ -3410,8 +3410,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 */