]>
Commit | Line | Data |
---|---|---|
8bb59888 GKH |
1 | From b2a72ec32d0f499aaadf41264232517a12326df0 Mon Sep 17 00:00:00 2001 |
2 | From: Dan Carpenter <dan.carpenter@oracle.com> | |
3 | Date: Tue, 21 Jan 2014 10:00:10 +0300 | |
4 | Subject: SCSI: qla2xxx: fix error handling of qla2x00_mem_alloc() | |
5 | ||
6 | From: Dan Carpenter <dan.carpenter@oracle.com> | |
7 | ||
8 | commit b2a72ec32d0f499aaadf41264232517a12326df0 upstream. | |
9 | ||
10 | qla2x00_mem_alloc() returns 1 on success and -ENOMEM on failure. On the | |
11 | one hand the caller assumes non-zero is success but on the other hand | |
12 | the caller also assumes that it returns an error code. | |
13 | ||
14 | I've fixed it to return zero on success and a negative error code on | |
15 | failure. This matches the documentation as well. | |
16 | ||
17 | [jejb: checkpatch fix] | |
18 | Fixes: e315cd28b9ef ('[SCSI] qla2xxx: Code changes for qla data structure refactoring') | |
19 | Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> | |
20 | Acked-by: Saurav Kashyap <saurav.kashyap@qlogic.com> | |
21 | Signed-off-by: James Bottomley <JBottomley@Parallels.com> | |
22 | Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> | |
23 | ||
24 | --- | |
25 | drivers/scsi/qla2xxx/qla_os.c | 6 +++--- | |
26 | 1 file changed, 3 insertions(+), 3 deletions(-) | |
27 | ||
28 | --- a/drivers/scsi/qla2xxx/qla_os.c | |
29 | +++ b/drivers/scsi/qla2xxx/qla_os.c | |
30 | @@ -2536,7 +2536,7 @@ qla2x00_probe_one(struct pci_dev *pdev, | |
31 | ha->flags.enable_64bit_addressing ? "enable" : | |
32 | "disable"); | |
33 | ret = qla2x00_mem_alloc(ha, req_length, rsp_length, &req, &rsp); | |
34 | - if (!ret) { | |
35 | + if (ret) { | |
36 | ql_log_pci(ql_log_fatal, pdev, 0x0031, | |
37 | "Failed to allocate memory for adapter, aborting.\n"); | |
38 | ||
39 | @@ -3478,10 +3478,10 @@ qla2x00_mem_alloc(struct qla_hw_data *ha | |
40 | else { | |
41 | qla2x00_set_reserved_loop_ids(ha); | |
42 | ql_dbg_pci(ql_dbg_init, ha->pdev, 0x0123, | |
43 | - "loop_id_map=%p. \n", ha->loop_id_map); | |
44 | + "loop_id_map=%p.\n", ha->loop_id_map); | |
45 | } | |
46 | ||
47 | - return 1; | |
48 | + return 0; | |
49 | ||
50 | fail_async_pd: | |
51 | dma_pool_free(ha->s_dma_pool, ha->ex_init_cb, ha->ex_init_cb_dma); |