From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755127Ab0HPQ3R (ORCPT ); Mon, 16 Aug 2010 12:29:17 -0400 Received: from mgw2.diku.dk ([130.225.96.92]:50934 "EHLO mgw2.diku.dk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754792Ab0HPQ3P (ORCPT ); Mon, 16 Aug 2010 12:29:15 -0400 Date: Mon, 16 Aug 2010 18:29:13 +0200 (CEST) From: Julia Lawall To: Amit Kumar Salecha , Anirban Chakraborty , linux-driver@qlogic.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH 16/16] drivers/net/qlcnic: Use available error codes Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Julia Lawall The error code is stored in the variable err, but it is the variable ret that is returned instead. So store the error code in ret. Err is then useless. The semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @r@ local idexpression x; constant C; @@ if (...) { ... x = -C ... when != x ( return <+...x...+>; | return NULL; | return; | * return ...; ) } // Signed-off-by: Julia Lawall --- This changes the semantics and has not been tested. drivers/net/qlcnic/qlcnic_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/qlcnic/qlcnic_main.c b/drivers/net/qlcnic/qlcnic_main.c index b9615bd..142ab1d 100644 --- a/drivers/net/qlcnic/qlcnic_main.c +++ b/drivers/net/qlcnic/qlcnic_main.c @@ -474,7 +474,7 @@ static int qlcnic_init_pci_info(struct qlcnic_adapter *adapter) { struct qlcnic_pci_info pci_info[QLCNIC_MAX_PCI_FUNC]; - int i, ret = 0, err; + int i, ret = 0; u8 pfn; if (!adapter->npars) @@ -487,7 +487,7 @@ qlcnic_init_pci_info(struct qlcnic_adapter *adapter) adapter->eswitch = kzalloc(sizeof(struct qlcnic_eswitch) * QLCNIC_NIU_MAX_XG_PORTS, GFP_KERNEL); if (!adapter->eswitch) { - err = -ENOMEM; + ret = -ENOMEM; goto err_eswitch; }