Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp1527409pxb; Thu, 16 Sep 2021 09:16:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyIabBVPkPzaGTwgfUNOlkyfx9cHp9UHxgQIR15/WII7+dqv1tip2UMXdF/9/Z6WudvCaCE X-Received: by 2002:a17:906:f289:: with SMTP id gu9mr6818745ejb.559.1631808966315; Thu, 16 Sep 2021 09:16:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631808966; cv=none; d=google.com; s=arc-20160816; b=QIuo9yMFMTFNLf4q+19mpatecBxPsT6vmMjFSdJLTJmFHFbFqV9a0NSBchZuvKoC9w xR71W5CHEhIrXG3+T8SFifeqqBq1doVQn1XKSOFCTgvXuRU4rE+M+5z8Nw89mHgvlYd5 nzFf3w7eFEYF4DTZHONJae2ZKo4/vKHOHkWU1aaoXMgfPFI0B4+htVUfY5yEez4/OvoT KK7Egca3u78O8/gmrbRjh/cqKxuMvaZG46yJ2SDh23No8jF2Oj0mK8ihnkzbLav2TxHR fYi5DW3M3hzJGAsZp0eePOilRt4Y7mS3XYNlJ/yB9/nWNoj5pypLfJ83dtK7HnZku0xK gBwA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=gUtbonwTHFKbjj4oZeaDm3mW/1xhF0y13GsrndQeCzE=; b=jsOgYIUMrP4w6KcH6Zn+8LE6Rfvn9acwdgwtIvYDiA5N6U+LV7vnizT4dQcJfqwULk aM2oMEiAIAuQm6lKgZ2NEuUMzCytMH1bp7gt88U/7pFc0ds+MMEaqRZagTzqK4DwJJZb IZhYrtbgYaA6qF2NcmLd4mvFm3y9OE/iFo15SysdW8pwN1U9Olb5G/Db38g2bOI0Vd8P f9bxBO/UgphNIWkHUvdV/4kUufiGon9UmtV8qEOHSrk806qp+y8mPMTosuZyhwf4VlBb W8l9P7mvYpBG7KA9y5XDxIQhFUldX/LYA74FkbYgG39H4Yvgcf6AiIKvhiWpli3qNpDN fMuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=KjVKu8L1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u4si4402984ejt.53.2021.09.16.09.15.40; Thu, 16 Sep 2021 09:16:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=KjVKu8L1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233681AbhIPQOA (ORCPT + 99 others); Thu, 16 Sep 2021 12:14:00 -0400 Received: from mail.kernel.org ([198.145.29.99]:48684 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235132AbhIPQIY (ORCPT ); Thu, 16 Sep 2021 12:08:24 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 22D8C61268; Thu, 16 Sep 2021 16:07:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1631808423; bh=8XWIXUWufZn5FSq7J1t9wv5kAwa8ORERlVdBzcM35mA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KjVKu8L1FX3xZ+zFyCJmkds25IpenixjVwjXJvGagU1V0ko2qAhscDRqzDYfyi8Ss dWP7VHPba+kqSIgEfOP4amzKeyZY4saigB6ngl9STxk9OBKLnRVz5bK8FBVUL3Ujaa Dy+K5hBeVYeOPtP0Jv2qpFDTRSlJtZWsYjbEFUN8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Manish Rangankar , Dan Carpenter , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.10 086/306] scsi: qedi: Fix error codes in qedi_alloc_global_queues() Date: Thu, 16 Sep 2021 17:57:11 +0200 Message-Id: <20210916155756.988397094@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210916155753.903069397@linuxfoundation.org> References: <20210916155753.903069397@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dan Carpenter [ Upstream commit 4dbe57d46d54a847875fa33e7d05877bb341585e ] 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. Link: https://lore.kernel.org/r/20210810084753.GD23810@kili Fixes: ace7f46ba5fd ("scsi: qedi: Add QLogic FastLinQ offload iSCSI driver framework.") Acked-by: Manish Rangankar Signed-off-by: Dan Carpenter Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin --- 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 b33eff9ea80b..299d0369e4f0 100644 --- a/drivers/scsi/qedi/qedi_main.c +++ b/drivers/scsi/qedi/qedi_main.c @@ -1623,7 +1623,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; @@ -1634,14 +1634,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; } @@ -1656,13 +1656,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 -- 2.30.2