In function beiscsi_create_cqs() at drivers/scsi/be2iscsi/be_main.c:line 3305, if pci_alloc_consistent() at line 3326 fails, function beiscsi_create_cqs() will return the value of variable ret, which is 0 indicating success defined at line 3310.But,function beiscsi_create_cqs() should propagate the error and return the error to its caller functions. The related code snippets in beiscsi_create_cqs are as following. beiscsi_create_cqs @@ drivers/scsi/be2iscsi/be_main.c:line 3305 3305 static int beiscsi_create_cqs(struct beiscsi_hba *phba, 3306 struct hwi_context_memory *phwi_context) 3307 { 3308 unsigned int i, num_cq_pages; 3309 int ret = 0; 3310 struct be_queue_info *cq, *eq; 3311 struct be_dma_mem *mem; 3312 struct be_eq_obj *pbe_eq; 3313 void *cq_vaddress; 3314 dma_addr_t paddr; 3315 3316 num_cq_pages = PAGES_REQUIRED(phba->params.num_cq_entries * \ 3317 sizeof(struct sol_cqe)); 3318 3319 for (i = 0; i < phba->num_cpus; i++) { 3320 cq = &phwi_context->be_cq[i]; 3321 eq = &phwi_context->be_eq[i].q; 3322 pbe_eq = &phwi_context->be_eq[i]; 3323 pbe_eq->cq = cq; 3324 pbe_eq->phba = phba; 3325 mem = &cq->dma_mem; 3326 cq_vaddress = pci_alloc_consistent(phba->pcidev, 3327 num_cq_pages * PAGE_SIZE, 3328 &paddr); 3329 if (!cq_vaddress) 3330 goto create_cq_error; ... 3352 } ... 3353 return 0; 3354 3355 create_cq_error: 3356 for (i = 0; i < phba->num_cpus; i++) { 3357 cq = &phwi_context->be_cq[i]; 3358 mem = &cq->dma_mem; 3359 if (mem->va) 3360 pci_free_consistent(phba->pcidev, num_cq_pages 3361 * PAGE_SIZE, 3362 mem->va, mem->dma); 3363 } 3364 return ret; 3365 3366 } Generally, when the call to pci_alloc_consistent() fails, the return value of caller functions should be different from another return value set when the call to pci_alloc_consistent() succeeds, like the following codes in another file. ilo_ccb_setup @@ drivers/net/ethernet/hp/hp100.c:line 726 258 static int ilo_ccb_setup(struct ilo_hwinfo *hw, struct ccb_data *data, int slot) 259 { ... 271 data->dma_va = pci_alloc_consistent(hw->ilo_dev, data->dma_size, 272 &data->dma_pa); 273 if (!data->dma_va) 274 return -ENOMEM; ... }
*** Bug 114251 has been marked as a duplicate of this bug. ***