Skip to contentSkip to conversation

scsi: qla2xxx: Return -ENOMEM if kzalloc() fails

PATCH Applied Zheyu Ma 3 participants 3 messages Oct 18, 2021 – Oct 19, 2021

Subsystems (2)
lore
Share & tools
lore

Zheyu Ma

author
#0 lore raw

PATCH 1/1 scsi: qla2xxx: Return -ENOMEM if kzalloc() fails

During the process of driver probing, probe function should return < 0 for failure, otherwise kernel will treat value > 0 as success.

---
 drivers/scsi/qla2xxx/qla_os.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/qla2xxx/qla_os.c +1 -1
index d2e40aaba734..836fedcea241 100644
@@ -4157,7 +4157,7 @@ qla2x00_mem_alloc(struct qla_hw_data *ha, uint16_t req_len, uint16_t rsp_len,
 					ql_dbg_pci(ql_dbg_init, ha->pdev,
 					    0xe0ee, "%s: failed alloc dsd\n",
 					    __func__);
-					return 1;
+					return -ENOMEM;
 				}
 				ha->dif_bundle_kallocs++;
 
Signature · 1 line
2.17.6
Reviewed-by on v1 1/1
#1 lore raw
Quoted 28 lines · Zheyu Ma

During the process of driver probing, probe function should return < 0 for failure, otherwise kernel will treat value > 0 as success.

---
drivers/scsi/qla2xxx/qla_os.c | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/qla2xxx/qla_os.c +1 -1
index d2e40aaba734..836fedcea241 100644
@@ -4157,7 +4157,7 @@ qla2x00_mem_alloc(struct qla_hw_data *ha, uint16_t req_len, uint16_t rsp_len,
 					ql_dbg_pci(ql_dbg_init, ha->pdev,
 					    0xe0ee, "%s: failed alloc dsd\n",
 					    __func__);
-					return 1;
+					return -ENOMEM;
 				}
 				ha->dif_bundle_kallocs++;
 
Signature · 1 line
2.17.6

--
Himanshu Madhani Oracle Linux Engineering