Print this page
5253 kmem_alloc/kmem_zalloc won't fail with KM_SLEEP
5254 getrbuf won't fail with KM_SLEEP
*** 183,206 ****
ha->instance);
return (0);
}
xp = kmem_zalloc(sizeof (ql_xioctl_t), KM_SLEEP);
- if (xp == NULL) {
- EL(ha, "failed, kmem_zalloc\n");
- return (ENOMEM);
- }
ha->xioctl = xp;
/* Allocate AEN tracking buffer */
xp->aen_tracking_queue = kmem_zalloc(EXT_DEF_MAX_AEN_QUEUE *
sizeof (EXT_ASYNC_EVENT), KM_SLEEP);
- if (xp->aen_tracking_queue == NULL) {
- EL(ha, "failed, kmem_zalloc-2\n");
- ql_free_xioctl_resource(ha);
- return (ENOMEM);
- }
QL_PRINT_9(CE_CONT, "(%d): done\n", ha->instance);
return (0);
}
--- 183,197 ----
*** 1528,1543 ****
}
/* Allocate command block. */
pkt_size = (uint32_t)(sizeof (ql_mbx_iocb_t) + pld_byte_cnt);
pkt = kmem_zalloc(pkt_size, KM_SLEEP);
- if (pkt == NULL) {
- EL(ha, "failed, kmem_zalloc\n");
- cmd->Status = EXT_STATUS_NO_MEMORY;
- cmd->ResponseLen = 0;
- return;
- }
pld = (caddr_t)pkt + sizeof (ql_mbx_iocb_t);
/* Get command payload data. */
if (ql_get_buffer_data((caddr_t)(uintptr_t)cmd->RequestAdr, pld,
cmd->RequestLen, mode) != cmd->RequestLen) {
--- 1519,1528 ----
*** 2138,2153 ****
scsi_req.direction == EXT_DEF_SCSI_PASSTHRU_DATA_OUT) &&
cmd->ResponseLen) {
pld_size = cmd->ResponseLen;
pkt_size = (uint32_t)(sizeof (ql_mbx_iocb_t) + pld_size);
pkt = kmem_zalloc(pkt_size, KM_SLEEP);
- if (pkt == NULL) {
- EL(ha, "failed, kmem_zalloc\n");
- cmd->Status = EXT_STATUS_NO_MEMORY;
- cmd->ResponseLen = 0;
- return;
- }
pld = (caddr_t)pkt + sizeof (ql_mbx_iocb_t);
/* Get DMA memory for the IOCB */
if (ql_get_dma_mem(ha, dma_mem, pld_size, LITTLE_ENDIAN_DMA,
QL_DMA_DATA_ALIGN) != QL_SUCCESS) {
--- 2123,2132 ----
*** 2196,2210 ****
(CFG_IST(ha, CFG_CTRL_24258081) ? 0 : CF_STAG);
cmd->ResponseLen = 0;
pkt_size = sizeof (ql_mbx_iocb_t);
pkt = kmem_zalloc(pkt_size, KM_SLEEP);
- if (pkt == NULL) {
- EL(ha, "failed, kmem_zalloc-2\n");
- cmd->Status = EXT_STATUS_NO_MEMORY;
- return;
- }
pld = NULL;
pld_size = 0;
}
/* retries = ha->port_down_retry_count; */
--- 2175,2184 ----
*** 3360,3375 ****
return;
}
/* Allocate command memory. */
bp = kmem_zalloc(plbreq.TransferCount, KM_SLEEP);
- if (bp == NULL) {
- EL(ha, "failed, kmem_zalloc\n");
- cmd->Status = EXT_STATUS_NO_MEMORY;
- cmd->ResponseLen = 0;
- return;
- }
/* Get loopback data. */
if (ql_get_buffer_data((caddr_t)(uintptr_t)plbreq.BufferAddress,
bp, plbreq.TransferCount, mode) != plbreq.TransferCount) {
EL(ha, "failed, ddi_copyin-2\n");
--- 3334,3343 ----
*** 3658,3673 ****
}
}
/* Allocate memory for command. */
tmp_buf = kmem_zalloc(SEND_RNID_RSP_SIZE, KM_SLEEP);
- if (tmp_buf == NULL) {
- EL(ha, "failed, kmem_zalloc\n");
- cmd->Status = EXT_STATUS_NO_MEMORY;
- cmd->ResponseLen = 0;
- return;
- }
if (local_hba) {
rval = ql_get_rnid_params(ha, SEND_RNID_RSP_SIZE, tmp_buf);
if (rval != QL_SUCCESS) {
EL(ha, "failed, get_rnid_params_mbx=%xh\n", rval);
--- 3626,3635 ----
*** 4029,4042 ****
return (0);
}
pkt_size = sizeof (ql_mbx_iocb_t) + sizeof (ql_rpt_lun_lst_t);
pkt = kmem_zalloc(pkt_size, KM_SLEEP);
- if (pkt == NULL) {
- EL(ha, "failed, kmem_zalloc\n");
- return (0);
- }
rpt = (ql_rpt_lun_lst_t *)((caddr_t)pkt + sizeof (ql_mbx_iocb_t));
/* Get DMA memory for the IOCB */
if (ql_get_dma_mem(ha, &dma_mem, sizeof (ql_rpt_lun_lst_t),
LITTLE_ENDIAN_DMA, QL_DMA_RING_ALIGN) != QL_SUCCESS) {
--- 3991,4000 ----
*** 4273,4286 ****
QL_PRINT_9(CE_CONT, "(%d): started\n", ha->instance);
pkt_size = sizeof (ql_mbx_iocb_t) + INQ_DATA_SIZE;
pkt = kmem_zalloc(pkt_size, KM_SLEEP);
- if (pkt == NULL) {
- EL(ha, "failed, kmem_zalloc\n");
- return (0);
- }
inq = (uint8_t *)((caddr_t)pkt + sizeof (ql_mbx_iocb_t));
cnt = 0;
for (lun = 0; lun < MAX_LUNS; lun++) {
--- 4231,4240 ----
*** 4696,4709 ****
if (ha->flash_desc_addr == 0) {
QL_PRINT_9(CE_CONT, "(%d): desc ptr=0\n", ha->instance);
return (QL_FUNCTION_FAILED);
}
! if ((fdesc = kmem_zalloc(sizeof (flash_desc_t), KM_SLEEP)) == NULL) {
! EL(ha, "kmem_zalloc=null\n");
! return (QL_MEMORY_ALLOC_FAILED);
! }
rval = ql_dump_fcode(ha, (uint8_t *)fdesc, sizeof (flash_desc_t),
ha->flash_desc_addr << 2);
if (rval != QL_SUCCESS) {
EL(ha, "read status=%xh\n", rval);
kmem_free(fdesc, sizeof (flash_desc_t));
--- 4650,4660 ----
if (ha->flash_desc_addr == 0) {
QL_PRINT_9(CE_CONT, "(%d): desc ptr=0\n", ha->instance);
return (QL_FUNCTION_FAILED);
}
! fdesc = kmem_zalloc(sizeof (flash_desc_t), KM_SLEEP);
rval = ql_dump_fcode(ha, (uint8_t *)fdesc, sizeof (flash_desc_t),
ha->flash_desc_addr << 2);
if (rval != QL_SUCCESS) {
EL(ha, "read status=%xh\n", rval);
kmem_free(fdesc, sizeof (flash_desc_t));
*** 5433,5448 ****
return;
}
/* Allocate memory for command. */
tmp_buf = kmem_zalloc(sizeof (EXT_RNID_DATA), KM_SLEEP);
- if (tmp_buf == NULL) {
- EL(ha, "failed, kmem_zalloc\n");
- cmd->Status = EXT_STATUS_NO_MEMORY;
- cmd->ResponseLen = 0;
- return;
- }
rval = ql_get_rnid_params(ha, sizeof (EXT_RNID_DATA),
(caddr_t)tmp_buf);
if (rval != QL_SUCCESS) {
/* error */
--- 5384,5393 ----
*** 5496,5511 ****
return;
}
/* Allocate memory for command. */
tmp_buf = kmem_zalloc(sizeof (EXT_RNID_DATA), KM_SLEEP);
- if (tmp_buf == NULL) {
- EL(ha, "failed, kmem_zalloc\n");
- cmd->Status = EXT_STATUS_NO_MEMORY;
- cmd->ResponseLen = 0;
- return;
- }
/* Send command */
rval = ql_get_rnid_params(ha, sizeof (EXT_RNID_DATA),
(caddr_t)tmp_buf);
if (rval != QL_SUCCESS) {
--- 5441,5450 ----
*** 5633,5648 ****
}
}
/* Allocate memory for command. */
ls = kmem_zalloc(sizeof (ql_link_stats_t), KM_SLEEP);
- if (ls == NULL) {
- EL(ha, "failed, kmem_zalloc\n");
- cmd->Status = EXT_STATUS_NO_MEMORY;
- cmd->ResponseLen = 0;
- return;
- }
/*
* I think these are supposed to be port statistics
* the loop ID or port ID should be in cmd->Instance.
*/
--- 5572,5581 ----
*** 5755,5770 ****
}
}
/* Allocate memory for command. */
ls = kmem_zalloc(sizeof (ql_link_stats_t), KM_SLEEP);
- if (ls == NULL) {
- EL(ha, "failed, kmem_zalloc\n");
- cmd->Status = EXT_STATUS_NO_MEMORY;
- cmd->ResponseLen = 0;
- return;
- }
rval = ql_get_link_status(ha, tq->loop_id, sizeof (ql_link_stats_t),
(caddr_t)ls, 0);
if (rval != QL_SUCCESS) {
EL(ha, "failed, get_link_status=%xh, d_id=%xh\n", rval,
--- 5688,5697 ----
*** 6970,6983 ****
QL_PRINT_9(CE_CONT, "(%d): started\n", ha->instance);
/* Process flash layout table header */
len = sizeof (ql_flt_ptr_t);
! if ((bp = kmem_zalloc(len, KM_SLEEP)) == NULL) {
! EL(ha, "kmem_zalloc=null\n");
! return;
! }
/* Process pointer to flash layout table */
if ((rval = ql_dump_fcode(ha, bp, len, flt_paddr)) != QL_SUCCESS) {
EL(ha, "fptr dump_flash pos=%xh, status=%xh\n", flt_paddr,
rval);
--- 6897,6907 ----
QL_PRINT_9(CE_CONT, "(%d): started\n", ha->instance);
/* Process flash layout table header */
len = sizeof (ql_flt_ptr_t);
! bp = kmem_zalloc(len, KM_SLEEP);
/* Process pointer to flash layout table */
if ((rval = ql_dump_fcode(ha, bp, len, flt_paddr)) != QL_SUCCESS) {
EL(ha, "fptr dump_flash pos=%xh, status=%xh\n", flt_paddr,
rval);
*** 7030,7043 ****
uint16_t chksum, w16;
QL_PRINT_9(CE_CONT, "(%d): started faddr=%xh\n", ha->instance, faddr);
/* Process flash layout table header */
! if ((bp = kmem_zalloc(FLASH_LAYOUT_TABLE_SIZE, KM_SLEEP)) == NULL) {
! EL(ha, "kmem_zalloc=null\n");
! return;
! }
fhdr = (ql_flt_hdr_t *)bp;
/* Process flash layout table. */
if ((rval = ql_dump_fcode(ha, bp, FLASH_LAYOUT_TABLE_SIZE, faddr)) !=
QL_SUCCESS) {
--- 6954,6964 ----
uint16_t chksum, w16;
QL_PRINT_9(CE_CONT, "(%d): started faddr=%xh\n", ha->instance, faddr);
/* Process flash layout table header */
! bp = kmem_zalloc(FLASH_LAYOUT_TABLE_SIZE, KM_SLEEP);
fhdr = (ql_flt_hdr_t *)bp;
/* Process flash layout table. */
if ((rval = ql_dump_fcode(ha, bp, FLASH_LAYOUT_TABLE_SIZE, faddr)) !=
QL_SUCCESS) {
*** 7709,7724 ****
return;
}
/* Allocate payload buffer */
payload = kmem_zalloc(FWEXTSIZE, KM_SLEEP);
- if (payload == NULL) {
- EL(ha, "failed, kmem_zalloc\n");
- cmd->Status = EXT_STATUS_NO_MEMORY;
- cmd->ResponseLen = 0;
- return;
- }
/* Sync DMA buffer. */
(void) ddi_dma_sync(ha->fwexttracebuf.dma_handle, 0,
FWEXTSIZE, DDI_DMA_SYNC_FORKERNEL);
--- 7630,7639 ----
*** 7798,7813 ****
return;
}
/* Allocate payload buffer */
payload = kmem_zalloc(FWEXTSIZE, KM_SLEEP);
- if (payload == NULL) {
- EL(ha, "failed, kmem_zalloc\n");
- cmd->Status = EXT_STATUS_NO_MEMORY;
- cmd->ResponseLen = 0;
- return;
- }
/* Sync DMA buffer. */
(void) ddi_dma_sync(ha->fwfcetracebuf.dma_handle, 0,
FWFCESIZE, DDI_DMA_SYNC_FORKERNEL);
--- 7713,7722 ----
*** 7920,7933 ****
uint32_t *ptr32, *org_ptr32;
QL_PRINT_9(CE_CONT, "(%d): started\n", ha->instance);
ptr32 = kmem_zalloc(pci_size, KM_SLEEP);
- if (ptr32 == NULL) {
- EL(ha, "failed kmem_zalloc\n");
- return (ENOMEM);
- }
/* store the initial value of ptr32 */
org_ptr32 = ptr32;
for (pci_os = 0; pci_os < pci_size; pci_os += 4) {
*ptr32 = (uint32_t)ql_pci_config_get32(ha, pci_os);
--- 7829,7838 ----
*** 8071,8086 ****
return;
}
/* Allocate packet. */
pkt = kmem_zalloc(sizeof (ql_mbx_iocb_t), KM_SLEEP);
- if (pkt == NULL) {
- EL(ha, "failed, kmem_zalloc\n");
- cmd->Status = EXT_STATUS_NO_MEMORY;
- cmd->ResponseLen = 0;
- return;
- }
pkt->mvfy.entry_type = VERIFY_MENLO_TYPE;
pkt->mvfy.entry_count = 1;
pkt->mvfy.options_status = LE_16(VMF_DO_NOT_UPDATE_FW);
--- 7976,7985 ----
*** 8186,8203 ****
cmd->Status = EXT_STATUS_NO_MEMORY;
cmd->ResponseLen = 0;
return;
}
pkt = kmem_zalloc(sizeof (ql_mbx_iocb_t), KM_SLEEP);
- if (pkt == NULL) {
- EL(ha, "failed, kmem_zalloc\n");
- kmem_free(dma_mem, sizeof (dma_mem_t));
- ql_restart_hba(ha);
- cmd->Status = EXT_STATUS_NO_MEMORY;
- cmd->ResponseLen = 0;
- return;
- }
/* Get DMA memory for the IOCB */
if (ql_get_dma_mem(ha, dma_mem, fw.TotalByteCount, LITTLE_ENDIAN_DMA,
QL_DMA_DATA_ALIGN) != QL_SUCCESS) {
cmn_err(CE_WARN, "%s(%d): request queue DMA memory "
--- 8085,8094 ----
*** 8325,8341 ****
return;
}
/* Allocate packet. */
pkt = kmem_zalloc(sizeof (ql_mbx_iocb_t), KM_SLEEP);
- if (pkt == NULL) {
- EL(ha, "failed, kmem_zalloc\n");
- ql_restart_driver(ha);
- cmd->Status = EXT_STATUS_NO_MEMORY;
- cmd->ResponseLen = 0;
- return;
- }
pkt->mdata.entry_type = MENLO_DATA_TYPE;
pkt->mdata.entry_count = 1;
pkt->mdata.options_status = (uint16_t)LE_16(info.Operation);
--- 8216,8225 ----
*** 8821,8836 ****
return;
}
/* Allocate memory for command. */
tmp_buf = kmem_zalloc(EXT_DEF_DCBX_PARAM_BUF_SIZE, KM_SLEEP);
- if (tmp_buf == NULL) {
- EL(ha, "failed, kmem_zalloc\n");
- cmd->Status = EXT_STATUS_NO_MEMORY;
- cmd->ResponseLen = 0;
- return;
- }
/* Send command */
rval = ql_get_dcbx_params(ha, EXT_DEF_DCBX_PARAM_BUF_SIZE,
(caddr_t)tmp_buf);
if (rval != QL_SUCCESS) {
/* error */
--- 8705,8714 ----
*** 9069,9084 ****
return;
}
/* Allocate memory for command. */
tmp_buf = kmem_zalloc(size, KM_SLEEP);
- if (tmp_buf == NULL) {
- EL(ha, "failed, kmem_zalloc\n");
- cmd->Status = EXT_STATUS_NO_MEMORY;
- cmd->ResponseLen = 0;
- return;
- }
if (!(info.Operation & MENLO_OP_GET_INFO)) {
EL(ha, "Invalid request for 81XX\n");
kmem_free(tmp_buf, size);
cmd->Status = EXT_STATUS_ERR;
--- 8947,8956 ----
*** 9152,9167 ****
cmd->ResponseLen = 0;
return;
}
/* Allocate memory for command. */
tmp_buf = kmem_zalloc(fcf_list.BufSize, KM_SLEEP);
- if (tmp_buf == NULL) {
- EL(ha, "failed, kmem_zalloc\n");
- cmd->Status = EXT_STATUS_NO_MEMORY;
- cmd->ResponseLen = 0;
- return;
- }
/* build the descriptor */
if (fcf_list.Options) {
mb_fcf_list.options = FCF_LIST_RETURN_ONE;
} else {
mb_fcf_list.options = FCF_LIST_RETURN_ALL;
--- 9024,9033 ----