Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp1553934pxb; Thu, 16 Sep 2021 09:47:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz+3yIWI7kGW19evEpM1w9jZsXxn+7JwA3Fu7MrJeMo8iV5qNayank8kGIo4khQ3tI2IE/g X-Received: by 2002:aa7:d814:: with SMTP id v20mr7642408edq.169.1631810860322; Thu, 16 Sep 2021 09:47:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631810860; cv=none; d=google.com; s=arc-20160816; b=HM9l4nacRN/zOCpWv9IV131pdqZUeXLM+CHX/DYioWoSKO/JQnNu205nGjdcMhGo7A /zrCHAx1hPIF/g6v+xybB+5ptGqu70JA9ipKAHnPzlJiExXVhMdSmfQlr9g4mPI5PbKY AzR0f9XHthfQy/LZMWttjyO+4JixISMbSbrJsmquW/n7bJJUcdJx6Ljvb4fqyV3Y6Ykg RTK7MZMDQhNWH1oThctr9PvUPBMhwUjoAidDxK1d42K2wolfvDBUXqUTeKLOYhr8iB81 97zEgCUlW68wZddiO+xl7gHPx9kn13+rpUbubvIpYbGKHdRYwX1kQW+7cj9E4lufHln/ uYag== 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=yNa4+e3cvgnZLWKC34C9C4UNLFCGoEkGNWj8GeAqNIs=; b=lYjye5mGIQCyd44SsbsSXEeBxo7drTEyB96Rl/ZpsifRxwpsB2powzQgqeUE345cEF gOGf9jZUh0Bxp8clS6sRN+UUm2D3m0VYIQ445f1J/iwPC6LkU1oBolgmbwwHwvojD4mJ mGJHOQ5QauDC1EpFmbCEM1SjjbywMRBoCPZjCSlw4zFVpHUjQiM4OClboc3FxEhP6TNU RY5P1RZ2dBKKFu9f0tglSHDakp5p9MN24U8h6xH0Wmp9k4aYg9C21hsZF7zG4US+qw3R 3brbvZfcAsAsdP5glty+Qhry1JYlCvZTRqWlXFXMGmFT4oJBEwziIlq6AnTdVuF42ACd mO5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="KighQ/pU"; 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 h91si3907413edd.104.2021.09.16.09.47.15; Thu, 16 Sep 2021 09:47:40 -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="KighQ/pU"; 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 S243774AbhIPQqQ (ORCPT + 99 others); Thu, 16 Sep 2021 12:46:16 -0400 Received: from mail.kernel.org ([198.145.29.99]:50780 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245356AbhIPQkU (ORCPT ); Thu, 16 Sep 2021 12:40:20 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 5C84261A0B; Thu, 16 Sep 2021 16:23:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1631809418; bh=3U+Q2ExehCpShUzp7qfyAw0zZCRiu3dm9wxhWnkUSOE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KighQ/pUt7d80AZIYZWwiejw99hkIe7BeIrX9l+FFJBUWlro8+U3kJXLhqcaivdsU d+UEPsLARfAMlP9EipoZa19Defdl7AAZp10R2CFWysmIFRabJaZWkj24ptrY1Y2taB Xfz/gm9G/nglW1yVG5FEdrbVaLDhMVIBe8oI+qbA= 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.13 105/380] scsi: qedi: Fix error codes in qedi_alloc_global_queues() Date: Thu, 16 Sep 2021 17:57:42 +0200 Message-Id: <20210916155807.615511554@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210916155803.966362085@linuxfoundation.org> References: <20210916155803.966362085@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 edf915432704..99e1a323807d 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 -- 2.30.2