From patchwork Tue Aug 10 08:47:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 495544 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 078ECC4338F for ; Tue, 10 Aug 2021 08:48:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DD0A860234 for ; Tue, 10 Aug 2021 08:48:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236795AbhHJIsq (ORCPT ); Tue, 10 Aug 2021 04:48:46 -0400 Received: from mx0b-00069f02.pphosted.com ([205.220.177.32]:9780 "EHLO mx0b-00069f02.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233034AbhHJIso (ORCPT ); Tue, 10 Aug 2021 04:48:44 -0400 Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 17A8f6Di022835; Tue, 10 Aug 2021 08:48:14 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : content-type : mime-version; s=corp-2021-07-09; bh=mkPL7G8DEkk4G9Y0pzISCn82wsE1lDi3T43bUCqIZiQ=; b=NfcQ6MJsFV9cE5hx4GSFpgUpz7jZaccSfAXHaqcXAN/dd15v9jjMZMdSUpSiEBJldMTi LLob5LiJ24R0car1n4s+HMs14fjZ5nZzz8XW9KxmEekIwjXqevFy+vrnXx1xp0JrHHB1 xorBDlMnZVr/h5wzcnPf67mag0kBx7DvTjOUoUuSKNY+3lLsgm5AucCnd/IYP7zSEb5u L/Wn5rBCIYHQK//1lnj/3HlzTEH/kjAX3lMI8Q5efTAwyo7ki7UC3QGfnuHmrhnh8MO4 D8KpPTCwfWq+HX024OndPcwAI0N/eGig8jBEX/38srtxTaoGLPs5NfJOmC17vyLHv4rx 9g== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : content-type : mime-version; s=corp-2020-01-29; bh=mkPL7G8DEkk4G9Y0pzISCn82wsE1lDi3T43bUCqIZiQ=; b=rr61pfSEiqDufRqA77SS+SbE7pVHE95NFmg5vQPvWUmD2yig4xrVH5mQ9GLViQjJgfro 2mrX75FZy84Eq6uogHQe2fmTRa+tGsmA3n3Ke2rBV1EgAN2NHU0vzWqgYaP23xXiKHkD dIezPaXTU9PLYjSVTCGqcNYVKIYpXe346R6N3KoyKhI8IlsNmYxhISiMYmE8iKnRvAfo wLqWdhRMs83MOf0nbie2h0i3TNsfQcX3yi+S9WUrVje8jaDMN5wNnG9XawVj4X/9J7zD o76RENt+DTj1d5ZaTZ6VLqY+VmsqsPGcW4DrFa4nlLWbiz7NJVJlEqs9u1Us+heAAnG/ Yw== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by mx0b-00069f02.pphosted.com with ESMTP id 3aaqmuuf4f-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 10 Aug 2021 08:48:13 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 17A8eWSS189603; Tue, 10 Aug 2021 08:48:13 GMT Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2101.outbound.protection.outlook.com [104.47.58.101]) by aserp3030.oracle.com with ESMTP id 3aa8qsqnxr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 10 Aug 2021 08:48:12 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nBgXIPzayL/DC4T1rLmr0zOGKvk8zXL3o1S5H1Bklxccqfcet/eXMgRuwjhCpxRwZ/xCrwYTTOwmPxfj8lv8kuH9QCdnKlrzsMIZ9D7nThc8EvUa270ITXcMBeLLzQoxk2Q+cEEDEK7jD4rtmz/umuFvw6IPTQbeoKBoArGr1JbWrt4/V+21sQmMNFBNRE3a0LyKTn6EfYeugeHnh7GkI9IiTZFuMG463R1riv41IJmaKqZioOS702Srp71tjO3eiRhOqRMKsOtsNaTeQggauFB/iIsXTMgZeWcXFLOih5GvtyFy1rgX15gLFbZuSEg5fb0GX4zKpnwhHyabCjVvfQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=mkPL7G8DEkk4G9Y0pzISCn82wsE1lDi3T43bUCqIZiQ=; b=RvMxlPpSorufeW9HgJw5qrzSJN4LpIvbh2YvUA57l3ICekbP8u915oX4Z7eQw+3bdJf3gYMtFlCzfXUHT0HVU6nAmkB5j/ZbL3r34iqVJL6/HQoZM2osUL0Kl6E8DBIe39b35/SiTdM869p9zw4/nVcqdopi7cA3rfcskZQPhl3O9pHOPS/Em/f9Wt6TTetuhddnt1m+beJ5VbSJDzbCrdGeSKPQ6lXPFnaE14lI1BaHGVYyiwBB8paIs8bkhbsdCv39MKQkWkmGKwQlXRnw0zRk6uSd3p+SrXp5neWDSXlS2bXZ9dzr4mcQ9rD7/InJw5TRHnE1Mex6TQSzpDiiNg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=mkPL7G8DEkk4G9Y0pzISCn82wsE1lDi3T43bUCqIZiQ=; b=0TAqwHfwRbcjeQ1USLB57flASMz9mlrnPCOBCFrOVGdhSQdkThS945DC70fOfPAgoiuYF+9I1fnZ77Kko6A5IC5FPX6GEwBtJSk2+vQMp7gsyvsxcIWUv6YlysdX+27RTEnqfiBQZpc1pMGGzY+M95dDs8DzvWwVLnGyAPhTxmk= Authentication-Results: marvell.com; dkim=none (message not signed) header.d=none; marvell.com; dmarc=none action=none header.from=oracle.com; Received: from MWHPR1001MB2365.namprd10.prod.outlook.com (2603:10b6:301:2d::28) by MWHPR10MB1566.namprd10.prod.outlook.com (2603:10b6:300:27::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4394.16; Tue, 10 Aug 2021 08:48:11 +0000 Received: from MWHPR1001MB2365.namprd10.prod.outlook.com ([fe80::5820:e42b:73d7:4268]) by MWHPR1001MB2365.namprd10.prod.outlook.com ([fe80::5820:e42b:73d7:4268%7]) with mapi id 15.20.4394.023; Tue, 10 Aug 2021 08:48:11 +0000 Date: Tue, 10 Aug 2021 11:47:53 +0300 From: Dan Carpenter To: Nilesh Javali , Manish Rangankar Cc: GR-QLogic-Storage-Upstream@marvell.com, "James E.J. Bottomley" , "Martin K. Petersen" , Hannes Reinecke , Arun Easi , Adheer Chandravanshi , Johannes Thumshirn , linux-scsi@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH 1/2] scsi: qedi: Fix error codes in qedi_alloc_global_queues() Message-ID: <20210810084753.GD23810@kili> Content-Disposition: inline X-Mailer: git-send-email haha only kidding User-Agent: Mutt/1.10.1 (2018-07-13) X-ClientProxiedBy: ZR0P278CA0050.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:1d::19) To MWHPR1001MB2365.namprd10.prod.outlook.com (2603:10b6:301:2d::28) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from kili (102.222.70.252) by ZR0P278CA0050.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:1d::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4394.17 via Frontend Transport; Tue, 10 Aug 2021 08:48:04 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 835c8b53-ee0c-4592-6015-08d95bdb9503 X-MS-TrafficTypeDiagnostic: MWHPR10MB1566: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2657; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: szo9JNG2DeJpEdcFmcdSu1wwDLpMp6i5wbgaV7Zdo57E6sA2PQgrPB2bxTM4FFAnsvr3pXBXmabKiDgInTI5zUVgxyzhEwXZCUEgbztrit8AZvkkr8ZZ6EEoceO1ZY3Xigc9EhCLjzlzju9a6jB78HqP3e7tELoS5i4MySgEG50DIJxJ4BFBA+DTH726Fv44SPz9tPM89dmL321GDxKgPaCaEc11b+bUTJm4d/mQ0f9NkdYNaKavH7NIwB9f9SxqHnOzJOIyfvrUncIIzhEy65ObsobQeBF+VYDufy4LS7bN4GY60Int1m/poPmEgvycCYqcEj8qBsNpgSDYZPALuyR0HV5t0Bna09WoFtXN10LgyQvl5Mw4KCF0Y1IvJnmxd954t7hKIav+2Qm1OOrPGG42NGmnHEqB6w54UG5ZI8dC78gegrox/6x0nurr1jLM8XTrDyDbi6oDRAfIrVGBkgsBHixeMPKbkrLsgZ6ebqhPftPosTIDshmUpMlVYCTk1ZrYHnNFqHhGiefKUihmHVRGpdJN8KYxrBGvV15uXbWctV5JBZqmAYiiCUtJiXR6zeqij1jxdWD+Dvcslz1x1bS7mseXp6m0pvStFOz7/QcIL+wvrYmI80a/XHsdKtBwF/Om3bUbZiErByjK3lAWzMYsB0PR5N7KcOnUFzP+n6oMpl9tpybn30qmJLGXDHudsFe3l2Os3qTOAxncpriVHw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MWHPR1001MB2365.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(136003)(366004)(39860400002)(376002)(346002)(396003)(38350700002)(52116002)(1076003)(55016002)(86362001)(9686003)(478600001)(6496006)(956004)(83380400001)(33716001)(44832011)(54906003)(26005)(38100700002)(110136005)(6666004)(316002)(4326008)(8936002)(9576002)(66946007)(66476007)(66556008)(2906002)(8676002)(186003)(33656002)(5660300002)(7416002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: joewkOvjgb/vTGpnITsirQY0MT99aojnhzjqjX1NyOeOEenQs8wWv7MkkXt5QyCmsNX3qyhmBaM9VQ2H7VnqiYswyfUH5fpLifxGmsJRFEdDdFo0Kl+Vbk5mBa2rOkPUpDoM2rMHpIREn5dRNDPlfr61+yBasDPaA/Zd6ucBVjiXVdw730jaFpZYPFf0PEwzd5dXB3HcFaoAIdnXmd/ThLIgXSWRhL2i2D8dvHJHqv2hq5qFJJWyarNYSnzCrz0ghkr5jHbcWQttdaM9SBMOp6Te1RRXHwbjHZuBXMJmIfs5Kr/zbV7Ry6tDz03Z8T5HsqAbHx4BcaaSUAqcAKwPn/Tg0CUQsQxGoo8tSuViw/j6dvr73Dx4+fIHDSH9vSvngyGVHv1/nhQPKQLU6Jov8ZNf0gdkuGmFqDYaUkii62d487HNT9BURHaPl9988KtsHDW5IgSF2Uo5RvyW9pYNbnPIAGwdbszjLVddE5Jx4/XIL5BZzxzICjU1NZtO/2jvQVTi0oHOrTbrTlrE17S1Am9TQB9UgerZJMfyoNxgXWo84FwyrD4jrGVIKP3JG0NJgSFEh0coJzLdRbBJc18zhV1LnRRwu0JsYEMXzrauwQclSYVdAhJWDVdnXUjvTCgsCPGj8DK3xCsDFJph0rDdrgyDlCEWpBgKsUDpxr0Yc7bDOBHdXULWsQoJ+PneeLj6kQyv8JrgjH6szI6AXEHMAZjEPsolwgWJzhKU+R2tCfwEF1sQEkvjUzb2cxU5OOzf9eFsZbmPBq2u8IufL9WrDCAkIKk8UZB63QOJNess0+Dg37Ve76yOvck0hvv3CXfwTX+gx7zInTqrjcMcmLewjBDkLhq3/Q8pC1qWHWCmftSx5puvVBguG6ZFknnRsNn/blOzPspaDMgSvynbzsAegjU/2NL+PHaxe/i+n89vxl8QZO+eNOKv4QzR1GH/SPPvCqJ7Jjd0iCcNUVrsGpbbsh8cOM4xdBWeY9wwNYPCCg+bDj02cw6GuQHBVeGU9tsK3EOvp1+DZwDCBLFbT0bMWSIvbpupwbte8o5B3wneqQHkzywcyBH9fRQXX6CTGWQmngCsSAhd8/aan8zc49IQNIqE6aPol9QKGy0O0wFJIMEf6bCYqqlFcQlciUW3iU87mhLrsvB0uZdn7n3jNaeO+wg7HogAlw3Zkl/3b+WGLCpbLqAS9l1REwn+W6tRxq0kUka471z7icjutpO6yR9YcRkDyZkacBZSH8kCN09QMG8V21nC0mMwGSijlm6cJJ5wHNdeRWIMP4NQhtAF00CxLaQpF2Jk7ZDg3xHOKgqwIMkRbza9mzMgzjC+W+l2WbI7 X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 835c8b53-ee0c-4592-6015-08d95bdb9503 X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2365.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Aug 2021 08:48:10.9235 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: JCEngTm3nkHTIvr4XbSzzt7AOioK4GmrTLNgb7iA4ZgLQwz5RGZ0bEnvrqigMafKvznBmAxDX8aP4TnLdvMS+HnsQJguifBIOfUkNIqcoFg= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR10MB1566 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=10071 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 phishscore=0 mlxscore=0 spamscore=0 adultscore=0 bulkscore=0 malwarescore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2107140000 definitions=main-2108100054 X-Proofpoint-GUID: 1eE2uSpMID_uyg3n1in52XkOIeXcJWKG X-Proofpoint-ORIG-GUID: 1eE2uSpMID_uyg3n1in52XkOIeXcJWKG Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org This function had some left over code that returned 1 on error instead negative error codes. Convert everything to use negative error codes. The caller treats all non-zero returns the same so this does not affect run time. A couple places set "rc" instead of "status" so those error paths ended up returning success by mistake. Get rid of the "rc" variable and use "status" everywhere. Remove the bogus "status = 0" initialization, as a future proofing measure so the compiler will warn about uninitialized error codes. Fixes: ace7f46ba5fd ("scsi: qedi: Add QLogic FastLinQ offload iSCSI driver framework.") Signed-off-by: Dan Carpenter Acked-by: Manish Rangankar --- drivers/scsi/qedi/qedi_main.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/scsi/qedi/qedi_main.c b/drivers/scsi/qedi/qedi_main.c index 0b0acb827071..e6dc0b495a82 100644 --- a/drivers/scsi/qedi/qedi_main.c +++ b/drivers/scsi/qedi/qedi_main.c @@ -1621,7 +1621,7 @@ static int qedi_alloc_global_queues(struct qedi_ctx *qedi) { u32 *list; int i; - int status = 0, rc; + int status; u32 *pbl; dma_addr_t page; int num_pages; @@ -1632,14 +1632,14 @@ static int qedi_alloc_global_queues(struct qedi_ctx *qedi) */ if (!qedi->num_queues) { QEDI_ERR(&qedi->dbg_ctx, "No MSI-X vectors available!\n"); - return 1; + return -ENOMEM; } /* Make sure we allocated the PBL that will contain the physical * addresses of our queues */ if (!qedi->p_cpuq) { - status = 1; + status = -EINVAL; goto mem_alloc_failure; } @@ -1654,13 +1654,13 @@ static int qedi_alloc_global_queues(struct qedi_ctx *qedi) "qedi->global_queues=%p.\n", qedi->global_queues); /* Allocate DMA coherent buffers for BDQ */ - rc = qedi_alloc_bdq(qedi); - if (rc) + status = qedi_alloc_bdq(qedi); + if (status) goto mem_alloc_failure; /* Allocate DMA coherent buffers for NVM_ISCSI_CFG */ - rc = qedi_alloc_nvm_iscsi_cfg(qedi); - if (rc) + status = qedi_alloc_nvm_iscsi_cfg(qedi); + if (status) goto mem_alloc_failure; /* Allocate a CQ and an associated PBL for each MSI-X From patchwork Tue Aug 10 08:51:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 494678 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BA65AC4320A for ; Tue, 10 Aug 2021 08:52:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 992E560ED8 for ; Tue, 10 Aug 2021 08:52:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229991AbhHJIwp (ORCPT ); Tue, 10 Aug 2021 04:52:45 -0400 Received: from mx0a-00069f02.pphosted.com ([205.220.165.32]:51702 "EHLO mx0a-00069f02.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238433AbhHJIwe (ORCPT ); Tue, 10 Aug 2021 04:52:34 -0400 Received: from pps.filterd (m0246617.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 17A8pjed018651; Tue, 10 Aug 2021 08:52:07 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : content-type : in-reply-to : mime-version; s=corp-2021-07-09; bh=zKc/ptGddB1Y/sWFbxPtx9U+Yr9Os8V0kD85p4GH/d8=; b=FVoC99Q3qVwhs6VLv7+nY2/I8W001789U/WXCztnhnTo4l6a6ZtWI84cJD0GRJtxYfae QsIg9dZEcIjuVabn0eactuEBsPL/K1+uH/pwSzfxWyyN3GnPh0aA+vf7dUkkWdcANBVu Leh4VixVMr83wcs9hXSm4XFtwCTkgKTrrNXUg5d8Dq56pyJnmf30KnH2Pn57HQ6KzLTq +scgFcpUW/pAb51t5VdtYOXCzQ9aJ3HeWMCQreU0E7TFmyJpW0GhIUV7S+4AKzuwrGea TkZ3po3PQY0AUfCqDhnMg7+f5CsA9GMIWD5va9ZysX5kYqL+MUuxihAaV5wCeDnaFnSz 0A== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : content-type : in-reply-to : mime-version; s=corp-2020-01-29; bh=zKc/ptGddB1Y/sWFbxPtx9U+Yr9Os8V0kD85p4GH/d8=; b=I22nFj7f2A9Kqh2jKsryzO0wTMERJcKQaxpHw5sUp6cnsgZxifoA/HZ/7d20BNh7Mkbp Ot6gpLu6Gx22+GyuVQFOlEyV43DkfN2FCGuVdoGfWnuxs/Rh22OFcJfC9WZIRP5A7OJf n7JtC4/wQ6YTKdnYq0HIsO5ZuxVn7zS+MVrhrFrFiZ1pw09j3QYnLlZdNcgPhYFSACtN VuXV2YAtX6L8XsBEbCQSSBknqwg8IqM0VCAu+oSUCzHwEjYr6YNHrtCwQjhIJHwXvNK3 sL76R4zupIx6goHkUhjFXB2ON6uLmH+8Ysg9asPJ63PE0YsN2j/qKdPi0LL7IIfyadMr QQ== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by mx0b-00069f02.pphosted.com with ESMTP id 3aav18kfjf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 10 Aug 2021 08:52:06 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 17A8oL05148421; Tue, 10 Aug 2021 08:52:05 GMT Received: from nam02-dm3-obe.outbound.protection.outlook.com (mail-dm3nam07lp2041.outbound.protection.outlook.com [104.47.56.41]) by aserp3020.oracle.com with ESMTP id 3a9vv4bk9k-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 10 Aug 2021 08:52:05 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oPR9Lfq5iDLEWmPVZreYYTokvuSr2avmCqVmd4jWxifWYzz5oifw9eDWkmcTTE6lBHqR19inI0XtECc/olnwyj3YyLXuVOr0pBdxB23HcMbk/AsctOIRehAw8MJoyBDa4XGxBShV2jjQJg5fnQHeTNKmg2WEaR5365IETtBi2xWaBKRTxN2QDsHjtxsr3HIjViKbBY5CsrciCC8oVlp13fLai5/QTiZabYlYs2rlaY7ZLZ1nUDE8Y0eNofRPwTfJ6qFmqcfPwDI2g5M/h7gZE7CbAue2h0ymGp/KCv990mDYe3ZZpB/RpTVFb59H9r1tZfqUR0B/zwT/aZJJtZLZvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=zKc/ptGddB1Y/sWFbxPtx9U+Yr9Os8V0kD85p4GH/d8=; b=fy793SMtnFt9FTNsBehgQBDpVaYSbBD8KXuh6Lq2zu4ho9XBZFn81XC3vwGm3tcKRV6QYw7hYiOE0BMcdwlNBBu/8n+E5Xkbus7arUdtKYdH22LY2N52YZUf2h0AZVcf4fSl10FUxdXb1AJY5PmwOLHOh9dkD32cMIlxm9ynyoKjeiE5xobUflXllpr3tZ6ltNlGTF0qryDPTLq2//cFJU3o6ABpOMAekjVwYADe2gjI047HHXTsA0VgIUBJ8G9QVFRWHFvCqEnY6OPMqMUFU6v7+RZ47fCw9jbvHnRjEPHakug0fmkvcRh1watoflNs3iI4JKv3rXr9cpPK1irkzQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=zKc/ptGddB1Y/sWFbxPtx9U+Yr9Os8V0kD85p4GH/d8=; b=BHmemvpckanIxYBoTCwCkaZ49jK3sRctaLINSEnni9LFs298ss25ohGxIptd3bmLDOWA8tfrDPFlgUpHk/SWEqAOh5nhJJekf9VhAS8SUTB7wY3UEBqGsl4D8EbLwxIIuPIywhBpM6B7ReLFYlflRwsz2F2TC0pqrtTCZ9gWka8= Authentication-Results: marvell.com; dkim=none (message not signed) header.d=none; marvell.com; dmarc=none action=none header.from=oracle.com; Received: from MWHPR1001MB2365.namprd10.prod.outlook.com (2603:10b6:301:2d::28) by MWHPR10MB1886.namprd10.prod.outlook.com (2603:10b6:300:10e::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4394.16; Tue, 10 Aug 2021 08:52:03 +0000 Received: from MWHPR1001MB2365.namprd10.prod.outlook.com ([fe80::5820:e42b:73d7:4268]) by MWHPR1001MB2365.namprd10.prod.outlook.com ([fe80::5820:e42b:73d7:4268%7]) with mapi id 15.20.4394.023; Tue, 10 Aug 2021 08:52:03 +0000 Date: Tue, 10 Aug 2021 11:51:49 +0300 From: Dan Carpenter To: Saurav Kashyap , Dupuis Chad Cc: Javed Hasan , GR-QLogic-Storage-Upstream@marvell.com, "James E.J. Bottomley" , "Martin K. Petersen" , linux-scsi@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH 2/2] scsi: qedf: fix error codes in qedf_alloc_global_queues() Message-ID: <20210810085023.GA23998@kili> Content-Disposition: inline In-Reply-To: <20210810084753.GD23810@kili> X-Mailer: git-send-email haha only kidding User-Agent: Mutt/1.10.1 (2018-07-13) X-ClientProxiedBy: ZR0P278CA0086.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:22::19) To MWHPR1001MB2365.namprd10.prod.outlook.com (2603:10b6:301:2d::28) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from kili (102.222.70.252) by ZR0P278CA0086.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:22::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4394.17 via Frontend Transport; Tue, 10 Aug 2021 08:51:58 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 3212b2ba-0033-4c48-b33a-08d95bdc1fea X-MS-TrafficTypeDiagnostic: MWHPR10MB1886: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7691; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: rUTxpp/gtthJh9XbgQpVKTOUOh8wn3JCfGsT/RZCIOR0M0uFKqLV9ljvBoSVh/plAEstDUBJcn7g8bl7Ok600G85gEklcY0+YNk6qGvqjmtKcuuxO8wWLxVul7UGzcc2ngkZwMKXssROGilOQ3350pQcrPl1/Hh/545F3bUGHKDHw0QhBph7YYDhmBYJkyJCclpjFXWsmTdA16Z+9gFL4qVTepVh/JnELAOyj/dqohHkA5rgqLEotaMDqIT1xidYu+3LSUJRkirLHP74q74B1pBrnfPFW9bq6zXY8gSNuQXWjDGamYtnGuC4haMjD/VI3SRPConUVwmQqcW6iiYj9c31xHqvjE9F2IhTTWVeSDmA60dUIe/yMHbF2ds/lDUUaCFGmIiEr8vUMxXy2tEwdN+8AICPodHrpTUrwcMQXIL+6MBnD2WotXpM+L5PnquqTsTGc3ZmRn6NiGI4M3MDlvBUxdp7xooaJTwKRs5xbUlB1omjqyDN7/OSf+uRVJY/s+e8GryzpNQH0SSuzu+W18JAGjub/BzpItgd6nEXR53R4a27bgHBIqQDg7F4FJjO2gdBBLE/d5ynK82Q5DbBlMHwZLaO9KHxsJ5JCPXyoEaT/pL43uu8Tra64KvtZwEYMfqKTtAw3j2yHQ83SWWg8V4ogMXOBiGfX2Lce+CrDrikgN+sN2xeGE/9qw91PABtTm4sKTgBy6PWiQy5kcyhEQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MWHPR1001MB2365.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(366004)(33656002)(9686003)(55016002)(44832011)(86362001)(110136005)(66946007)(83380400001)(9576002)(4326008)(8936002)(1076003)(316002)(8676002)(66556008)(33716001)(66476007)(52116002)(38350700002)(6666004)(26005)(186003)(6496006)(508600001)(54906003)(956004)(5660300002)(2906002)(38100700002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: dXHnok4A4fA/sNoMNeMQ2mprcpCNbFUA0OZHbc/Z09JMXkuOvt0LyJGyzXZtsOiC0+ymzhHnCg0kO0vokTcj45AJQt3+iyxILvJCGw0k/UXq0iPtf8iZ4oiktuY9OWLk5o0y5w38r3cBbJwUVCCHWCh8oxEfLn7WzDY0nxgjn3dm5f2PUhIOdJipL/vtQYQqYZAiOop7OrwNRwTa2JEHar2fErJRGGL+BM9y/nstpLkfxIhRox9wbz21qcPfh+u+nkeCamvDiWdnT/t0obJ5EqBslXF9I8uNJtXQuRADcCcBtKbNCPG17/qlHn7qnv3NAGwExBASRt8kOAOWEQSOCnLxsbRcKVXW5Y7CdquVdrIBjWEDctHv0GVmEHtOAOSOHrZRyK9egu8HXB22OGMCFq8Lj+ZK4jNdyz5NHBUUTxSKKKKyCzuIEHJ9k35aOFcRzQuez97wIdNDT5aXmBUjZ6DAnL2QK0jz4VjOCc+Zx2sCHDy/7WADZEQWUK9EaQ3OGMSu+L54hPkIy5fur4IhvMtXIxPJkJIDrMdEOzo7lwn1kNQI2qEdu/9GLC1IDHgHVpFRSbEMucWq0vcFuZrRb4kSgko25XmRXg5LwE9YSO/Y7293SVDNz/f0vp6sX7a+cH81bP68WuLG/NWf3AOiHGxXW7zYsCbnEMnu1PZH8yrbTPf+afU4ffoumpJv+8xhJGg1xYdCNgAHh4BJpE+E+LtT5TenDinAlloyEECpF2J1l7LpVWdcYy9uI9tzrG5ilQ3b+/eZxIYhL6qCZ7PdrFvEFr12WaVT3ZzxcteAwjznsJI3mZBK8txAt/4UqPtHBoKhmIhAZvpSt16N+uW6r9ASPuxRL80xiVM2lhJRArv1u+fZIH5zf0lVHecWyAzaCe5/NhdQ4qZkmfDMyrAd9+INwsqlvaNBUMoSu9+j0UGDPMwaS5OmlsSEtnMEjbAyZvV11OVtLzuTsfzSUAgU7ohmwoKxpOc3KxSkaOFmKJBIY0ETo+OR/NEt97QnvqwI87hDs22O1RPBNtxOBtNk5V7wbFzSLHOV4sxfk1mKIPEh40khO8k7WKjqpr70u+L1mMC1ekc7vot9SrSpjQoG+vIyEWHjZEzeiJ9TntyoLECk1jHpRUntKdPDIoYlE2tgSsNgKck1C7gZX8lyeoy17jSZKUhqK/iuCYHsD1vviITwNbataXhpzo3OsDnYgkd0pn2YbNUu5fyeNRdIBcQjtH6wZblDJQ9EMVMHVs/eoktBeE23NBMW8r29XmRSgrKOYwiqTK41Ywjfdq4Tc3FZ1RH+ioB1MnG8egtaDjMurAa105gb4B+1SQexIZ0nF+BF X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3212b2ba-0033-4c48-b33a-08d95bdc1fea X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2365.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Aug 2021 08:52:03.8332 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: OqW0HRMz2GrW2RSFzfA4Y4OlG2vzJ9Gzrjp6fuafFa29eGoWd1DTUThmgDAf+eKrGszu7zJywYwG+YoFmcJvWdPLAMfNEhC2Cz9Z0ZaQFUE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR10MB1886 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=10071 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 suspectscore=0 mlxscore=0 phishscore=0 spamscore=0 mlxlogscore=999 malwarescore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2107140000 definitions=main-2108100055 X-Proofpoint-ORIG-GUID: vkFEYFfmO9EYeBoKDzhBdmYrHY09ecl4 X-Proofpoint-GUID: vkFEYFfmO9EYeBoKDzhBdmYrHY09ecl4 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org This driver has some left over "return 1" on failure style code mixed with "return negative error codes" style code. The caller doesn't care so we should just convert everything to return negative error codes. Then there was a problem that there were two variables used to store error codes which just resulted in confusion. If qedf_alloc_bdq() returned a negative error code, we accidentally returned success instead of propagating the error code. So get rid of the "rc" variable and use "status" every where. Also remove the "status = 0" initialization so that these sorts of bugs will be detected by the compiler in the future. Fixes: 61d8658b4a43 ("scsi: qedf: Add QLogic FastLinQ offload FCoE driver framework.") Signed-off-by: Dan Carpenter --- drivers/scsi/qedf/qedf_main.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/scsi/qedf/qedf_main.c b/drivers/scsi/qedf/qedf_main.c index 85f41abcb56c..42d0d941dba5 100644 --- a/drivers/scsi/qedf/qedf_main.c +++ b/drivers/scsi/qedf/qedf_main.c @@ -3004,7 +3004,7 @@ static int qedf_alloc_global_queues(struct qedf_ctx *qedf) { u32 *list; int i; - int status = 0, rc; + int status; u32 *pbl; dma_addr_t page; int num_pages; @@ -3016,7 +3016,7 @@ static int qedf_alloc_global_queues(struct qedf_ctx *qedf) */ if (!qedf->num_queues) { QEDF_ERR(&(qedf->dbg_ctx), "No MSI-X vectors available!\n"); - return 1; + return -ENOMEM; } /* @@ -3024,7 +3024,7 @@ static int qedf_alloc_global_queues(struct qedf_ctx *qedf) * addresses of our queues */ if (!qedf->p_cpuq) { - status = 1; + status = -EINVAL; QEDF_ERR(&qedf->dbg_ctx, "p_cpuq is NULL.\n"); goto mem_alloc_failure; } @@ -3040,8 +3040,8 @@ static int qedf_alloc_global_queues(struct qedf_ctx *qedf) "qedf->global_queues=%p.\n", qedf->global_queues); /* Allocate DMA coherent buffers for BDQ */ - rc = qedf_alloc_bdq(qedf); - if (rc) { + status = qedf_alloc_bdq(qedf); + if (status) { QEDF_ERR(&qedf->dbg_ctx, "Unable to allocate bdq.\n"); goto mem_alloc_failure; }