Commit 7dbe3aa2 authored by Karan Tilak Kumar's avatar Karan Tilak Kumar Committed by Martin K. Petersen
Browse files

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: default avatarDan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: default avatarSesidhar Baddela <sebaddel@cisco.com>
Reviewed-by: default avatarArulprabhu Ponnusamy <arulponn@cisco.com>
Reviewed-by: default avatarGian Carlo Boffa <gcboffa@cisco.com>
Reviewed-by: default avatarArun Easi <aeasi@cisco.com>
Signed-off-by: default avatarKaran Tilak Kumar <kartilak@cisco.com>
Link: https://lore.kernel.org/r/20250110091746.17671-1-kartilak@cisco.com


Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 0620efe7
Loading
Loading
Loading
Loading
+12 −4
Original line number Diff line number Diff line
@@ -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 */