Skip to content

Commit 7dbe3aa

Browse files
Karan Tilak Kumarmartinkpetersen
authored andcommitted
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>
1 parent 0620efe commit 7dbe3aa

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

drivers/scsi/fnic/fnic_main.c

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -888,24 +888,32 @@ static int fnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
888888
}
889889

890890
pool = mempool_create_slab_pool(2, fnic_sgl_cache[FNIC_SGL_CACHE_DFLT]);
891-
if (!pool)
891+
if (!pool) {
892+
err = -ENOMEM;
892893
goto err_out_free_resources;
894+
}
893895
fnic->io_sgl_pool[FNIC_SGL_CACHE_DFLT] = pool;
894896

895897
pool = mempool_create_slab_pool(2, fnic_sgl_cache[FNIC_SGL_CACHE_MAX]);
896-
if (!pool)
898+
if (!pool) {
899+
err = -ENOMEM;
897900
goto err_out_free_dflt_pool;
901+
}
898902
fnic->io_sgl_pool[FNIC_SGL_CACHE_MAX] = pool;
899903

900904
pool = mempool_create_slab_pool(FDLS_MIN_FRAMES, fdls_frame_cache);
901-
if (!pool)
905+
if (!pool) {
906+
err = -ENOMEM;
902907
goto err_out_fdls_frame_pool;
908+
}
903909
fnic->frame_pool = pool;
904910

905911
pool = mempool_create_slab_pool(FDLS_MIN_FRAME_ELEM,
906912
fdls_frame_elem_cache);
907-
if (!pool)
913+
if (!pool) {
914+
err = -ENOMEM;
908915
goto err_out_fdls_frame_elem_pool;
916+
}
909917
fnic->frame_elem_pool = pool;
910918

911919
/* setup vlan config, hw inserts vlan header */

0 commit comments

Comments
 (0)