Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b2a72ec3 authored by Dan Carpenter's avatar Dan Carpenter Committed by James Bottomley
Browse files

[SCSI] qla2xxx: fix error handling of qla2x00_mem_alloc()



qla2x00_mem_alloc() returns 1 on success and -ENOMEM on failure.  On the
one hand the caller assumes non-zero is success but on the other hand
the caller also assumes that it returns an error code.

I've fixed it to return zero on success and a negative error code on
failure.  This matches the documentation as well.

[jejb: checkpatch fix]
Fixes: e315cd28 ('[SCSI] qla2xxx: Code changes for qla data structure refactoring')
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Acked-by: default avatarSaurav Kashyap <saurav.kashyap@qlogic.com>
Signed-off-by: default avatarJames Bottomley <JBottomley@Parallels.com>
parent 2193b1b1
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -2599,7 +2599,7 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
	    ha->flags.enable_64bit_addressing ? "enable" :
	    "disable");
	ret = qla2x00_mem_alloc(ha, req_length, rsp_length, &req, &rsp);
	if (!ret) {
	if (ret) {
		ql_log_pci(ql_log_fatal, pdev, 0x0031,
		    "Failed to allocate memory for adapter, aborting.\n");

@@ -3545,7 +3545,7 @@ qla2x00_mem_alloc(struct qla_hw_data *ha, uint16_t req_len, uint16_t rsp_len,
		    "loop_id_map=%p.\n", ha->loop_id_map);
	}

	return 1;
	return 0;

fail_async_pd:
	dma_pool_free(ha->s_dma_pool, ha->ex_init_cb, ha->ex_init_cb_dma);