Received: by 2002:a05:6520:4d:b0:139:a872:a4c9 with SMTP id i13csp2565375lkm; Mon, 20 Sep 2021 18:51:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyjT72iHK1/EchBY2ApVosxgtif5iy/rLY5zMS9sH2kjNcvmgb939QqWkclZ43prh5ai4B3 X-Received: by 2002:a05:6602:4a:: with SMTP id z10mr10749957ioz.16.1632189095857; Mon, 20 Sep 2021 18:51:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632189095; cv=none; d=google.com; s=arc-20160816; b=XUXjQvAnUe8/CGzSyM0K9JrG7YBEOPX+ybUuS5wSxvUUfYtE4QlaF4VWGz8YAaPUJO jkMt0aaj+Oi4jGjL0PNMOjNg1UHCRH+9VIC5itLRoBk37NhoyrWq5ootefOvncnjtSGA VAAc29eHumrOVyLs4wWRWxryTJtQj85nKr8AlN3uYs7YOMtwU14XpgYJwkWCqrBUAPuQ BxOVsIqNcJHSkj8kFHAyQdrHg66IxwcwqrRpGDHsEJTSuD6FZiQ9yyi1FXOksvWNHv/H tWab690q6mw9x6783WDW9CKYg34hF1eI1BSB+VW66OGnI34g1+GcHIgAw9YdKSGIEI3c NvyQ== 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=qNs14DbuySUH5qmA3ER/RlgoK6G5Z/SdRsQoMDDe/RA=; b=CmUosdniur3YarX2Gplsh90bXrysfbYggmBfbSzjzWAMUWv6cNRMx0cRAYsEXnZrnZ pjOoJ1xxwO9WAYkPpWtVdgwyKdsupi1WVoaHF0WMIBicU20uoqz9/C8CNnaGQ9q0ws7c anL28iJXgYOXMLJdNS4XbxNufF/yxKrQXodm/6k3E0sfXLk8e1H+W8D8JU2XH4zrwz68 BEtXXy9pg90eJ3ZmfmqMyygPlRAH8WR1tZmmPSAPm6cBTMQk5EyiBz0v99VoIguoGZ4B uH6Y/okggohTw2+2n6K+/nnmHedyAgNMXt7mpk0vYqtak9aUHO7aiVH1Sh32r9fiDsli ji3A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=kQlIOYJz; 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 k26si7877722ioh.55.2021.09.20.18.51.23; Mon, 20 Sep 2021 18:51:35 -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=kQlIOYJz; 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 S245280AbhITSLz (ORCPT + 99 others); Mon, 20 Sep 2021 14:11:55 -0400 Received: from mail.kernel.org ([198.145.29.99]:60636 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346741AbhITSHD (ORCPT ); Mon, 20 Sep 2021 14:07:03 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 2798761A35; Mon, 20 Sep 2021 17:18:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1632158286; bh=+/1nsuDi+tyPxBD0+9K5v/wxHpR/m6VSnTAGq6eGaMU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kQlIOYJzjG84goyc2we/bqKWt5hhn1XrZvRTnr2bmTBmIHcUM98gctc0xRzitW4FW Tuh5vkWcinjWQmGrFJNfY3Sr/UaVZtAFOQpr2X202STH2pTStwzo1XIgoqLxyKQwmd y2XHn6GHs1N+DEuC1rdzs3t35m7oMFAXFinMBSgA= 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.4 054/260] scsi: qedi: Fix error codes in qedi_alloc_global_queues() Date: Mon, 20 Sep 2021 18:41:12 +0200 Message-Id: <20210920163932.942343739@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210920163931.123590023@linuxfoundation.org> References: <20210920163931.123590023@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 1ec42c5f0b2a..92c4a367b7bd 100644 --- a/drivers/scsi/qedi/qedi_main.c +++ b/drivers/scsi/qedi/qedi_main.c @@ -1553,7 +1553,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; @@ -1564,14 +1564,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; } @@ -1586,13 +1586,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