From: Karan Tilak Kumar Date: Fri, 10 Jan 2025 09:17:46 +0000 (-0800) Subject: scsi: fnic: Return appropriate error code for mem alloc failure X-Git-Tag: v6.14-rc1~80^2^2~3 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7dbe3aa2f3f83949174b64860dadfaeec3454cff;p=thirdparty%2Fkernel%2Flinux.git scsi: fnic: Return appropriate error code for mem alloc failure 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 Link: https://lore.kernel.org/r/20250110091746.17671-1-kartilak@cisco.com Signed-off-by: Martin K. Petersen --- diff --git a/drivers/scsi/fnic/fnic_main.c b/drivers/scsi/fnic/fnic_main.c index 3a900d540f211..2d51adf18501a 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 */