From patchwork Fri Jan 10 09:17:46 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Karan Tilak Kumar X-Patchwork-Id: 856882 Received: from alln-iport-6.cisco.com (alln-iport-6.cisco.com [173.37.142.93]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3519320B200; Fri, 10 Jan 2025 09:18:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=173.37.142.93 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736500698; cv=none; b=C3YOUqooPIK3pAWtWqGek0P8yO2YAfQOnbDuEqR8ROA9G8d5SOLeKaIidoDuF1B5sPOlFJ9YN+agWgCDxeuSB8/H4MfRj4X1rxqvX+AqdqKjFlnLPWvKpUUN5SwL+cIVipwcYAySZspV6IsGtdN/fkyb6B6ZmzlOJczl5BqFbPY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736500698; c=relaxed/simple; bh=KW5LX1zGbnQvQHXIUeNOMe/eQV4O1SeF5Hy37NCrzOk=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=SrPNXfwG26WUuMbLJzaMe485mV5zVdJuEkYOUIF082h3UhnzU3l312GdtkxSPYrOmZPbZdtvMjr2+UJVGre06yfC3PjDjQIRmNxUz5bCOYM7TcpfNzO45GiUxzGp40aRdXc3mL83WUcAOFR/Kh8PiAJt+UC7JlRZqp7/BXGeCTI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=cisco.com; spf=pass smtp.mailfrom=cisco.com; dkim=pass (1024-bit key) header.d=cisco.com header.i=@cisco.com header.b=eIcYGgnu; arc=none smtp.client-ip=173.37.142.93 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=cisco.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=cisco.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=cisco.com header.i=@cisco.com header.b="eIcYGgnu" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cisco.com; i=@cisco.com; l=1692; q=dns/txt; s=iport; t=1736500696; x=1737710296; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=NmUQn/0Lj+0XkDIiXo8FmxPSbVmVgdgXddxdnuCPz0Q=; b=eIcYGgnuXXUqVc7DQYB8LRG4gfCP8c0PUgo2tK0Y9uX5yBctB56iUZx8 1i49D5JhU9WdyFbazdZu+KBGTLA6dwBB1QAmllLU2bV9ksw8pUNdmrqxf 1wuDnBuksTew6Vyy82six5KLHJ80tcwdOMCjFed36coU2xbatOut/6R9R I=; X-CSE-ConnectionGUID: 8w7pkwCwRaiIQLxrEzCtrw== X-CSE-MsgGUID: VqkqzxN4SO2vURauyx7q8g== X-IPAS-Result: A0AjAQA35YBnj4r/Ja1aH4I9hBpDGS+0XoElA1YPAQEBD0QEAQGFB4p2AiY0CQ4BAgQBAQEBAwIDAQEBAQEBAQEBAQELAQEFAQEBAgEHBRQBAQEBAQE5BUmGCIZdKwsBRoFQgwGCZQOzNoF5M4EB3jOBbYFIjUqFZycVBoFJRIQOb4FSgz6FdwSHaJ5KSIEhA1ksAVUTDQoLBwWBcwM4DAswFTWBGnuCRmlJNwINAjWCHnyCK4RchEeEVoVlgheFeEADCxgNSBEsNxQbBj5uB5sbPINwewkKgkCTSZInoQOEJaFGGjOqUgGYfKktgWc6gVszGggbFYMiUhkPjjq8HyUyPAIHCwEBAwmGS4pTAQE IronPort-Data: A9a23:FyP6GKIDA1MLCNHIFE+RJZUlxSXFcZb7ZxGr2PjKsXjdYENS0zIDy WUWDGvXM/+MM2OkKdEkPNvno00FsZTQyYRgS1Ad+CA2RRqmiyZq6fd1j6vUF3nPRiEWZBs/t 63yU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z6xtjqRcKk89U6LEj021nm0ujMSGFXQqOMjjfhorfMFjYDPgFeZsZrnaPSe 4Gd6z4= IronPort-HdrOrdr: A9a23:ysB0261IrtCphRM3lZfnCAqjBIEkLtp133Aq2lEZdPWaSKClfq eV7ZYmPHDP5gr5NEtLpTniAtjifZq/z/9ICOAqVN/IYOCMggSVxe9ZgLfK8nnJBzD++ulB1a 1pbqRyTOHrAUMSt7ee3ODBKbYdKB3tytHOuQ8YpE0dKT1XVw== X-Talos-CUID: 9a23:5TWkAm5erTWX6+Kf99sspFFLAsM6WWLnxXbxGmuoE0t7Y6GPVgrF X-Talos-MUID: 9a23:Kp3dQA8D4XeY6kvrIdGW2VyQf/lx4L28GGZRqrJcpfS+PDFhK2iE3DviFw== X-IronPort-Anti-Spam-Filtered: true X-IronPort-AV: E=Sophos;i="6.12,303,1728950400"; d="scan'208";a="410607803" Received: from rcdn-l-core-01.cisco.com ([173.37.255.138]) by alln-iport-6.cisco.com with ESMTP/TLS/TLS_AES_256_GCM_SHA384; 10 Jan 2025 09:17:56 +0000 Received: from fedora.cisco.com (unknown [10.188.32.212]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: kartilak@cisco.com) by rcdn-l-core-01.cisco.com (Postfix) with ESMTPSA id 1DDA218000295; Fri, 10 Jan 2025 09:17:55 +0000 (GMT) From: Karan Tilak Kumar To: sebaddel@cisco.com Cc: arulponn@cisco.com, djhawar@cisco.com, gcboffa@cisco.com, mkai2@cisco.com, satishkh@cisco.com, aeasi@cisco.com, jejb@linux.ibm.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, Karan Tilak Kumar , Dan Carpenter Subject: [PATCH] scsi: fnic: Return appropriate error code for mem alloc failure Date: Fri, 10 Jan 2025 01:17:46 -0800 Message-ID: <20250110091746.17671-1-kartilak@cisco.com> X-Mailer: git-send-email 2.47.1 Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Authenticated-User: kartilak@cisco.com X-Outbound-SMTP-Client: 10.188.32.212, [10.188.32.212] X-Outbound-Node: rcdn-l-core-01.cisco.com Return appropriate error code from fnic_probe when memory create slab pool fails. Fix bug report. Suggested-by: Dan Carpenter Reviewed-by: Sesidhar Baddela Reviewed-by: Arulprabhu Ponnusamy Reviewed-by: Gian Carlo Boffa Reviewed-by: Arun Easi Signed-off-by: Karan Tilak Kumar --- drivers/scsi/fnic/fnic_main.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/drivers/scsi/fnic/fnic_main.c b/drivers/scsi/fnic/fnic_main.c index b5dca8e7e2e4..d366cbca04d5 100644 --- a/drivers/scsi/fnic/fnic_main.c +++ b/drivers/scsi/fnic/fnic_main.c @@ -888,24 +888,32 @@ static int fnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) } pool = mempool_create_slab_pool(2, fnic_sgl_cache[FNIC_SGL_CACHE_DFLT]); - if (!pool) + if (!pool) { + err = -ENOMEM; goto err_out_free_resources; + } fnic->io_sgl_pool[FNIC_SGL_CACHE_DFLT] = pool; pool = mempool_create_slab_pool(2, fnic_sgl_cache[FNIC_SGL_CACHE_MAX]); - if (!pool) + if (!pool) { + err = -ENOMEM; goto err_out_free_dflt_pool; + } fnic->io_sgl_pool[FNIC_SGL_CACHE_MAX] = pool; pool = mempool_create_slab_pool(FDLS_MIN_FRAMES, fdls_frame_cache); - if (!pool) + if (!pool) { + err = -ENOMEM; goto err_out_fdls_frame_pool; + } fnic->frame_pool = pool; pool = mempool_create_slab_pool(FDLS_MIN_FRAME_ELEM, fdls_frame_elem_cache); - if (!pool) + if (!pool) { + err = -ENOMEM; goto err_out_fdls_frame_elem_pool; + } fnic->frame_elem_pool = pool; /* setup vlan config, hw inserts vlan header */