diff options
author | Karan Tilak Kumar <kartilak@cisco.com> | 2025-01-10 12:17:46 +0300 |
---|---|---|
committer | Martin K. Petersen <martin.petersen@oracle.com> | 2025-01-11 02:22:26 +0300 |
commit | 7dbe3aa2f3f83949174b64860dadfaeec3454cff (patch) | |
tree | abd0069d59c5aefb91d2ae8814e34197aa8d453a | |
parent | 0620efe789a73586b5b3ed38b27d1b69b2150958 (diff) | |
download | linux-7dbe3aa2f3f83949174b64860dadfaeec3454cff.tar.xz |
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 <dan.carpenter@linaro.org>
Reviewed-by: Sesidhar Baddela <sebaddel@cisco.com>
Reviewed-by: Arulprabhu Ponnusamy <arulponn@cisco.com>
Reviewed-by: Gian Carlo Boffa <gcboffa@cisco.com>
Reviewed-by: Arun Easi <aeasi@cisco.com>
Signed-off-by: Karan Tilak Kumar <kartilak@cisco.com>
Link: https://lore.kernel.org/r/20250110091746.17671-1-kartilak@cisco.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
-rw-r--r-- | drivers/scsi/fnic/fnic_main.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/drivers/scsi/fnic/fnic_main.c b/drivers/scsi/fnic/fnic_main.c index 3a900d540f21..2d51adf18501 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 */ |