qla2x00t: Use kcalloc() instead of kzalloc() with multiply

git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6626 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Bart Van Assche
2015-11-09 17:40:07 +00:00
parent a6ff47ce0a
commit 5296640e97
2 changed files with 12 additions and 10 deletions

View File

@@ -2632,8 +2632,8 @@ qla24xx_enable_msix(struct qla_hw_data *ha, struct rsp_que *rsp)
struct qla_msix_entry *qentry;
scsi_qla_host_t *vha = pci_get_drvdata(ha->pdev);
entries = kzalloc(sizeof(struct msix_entry) * ha->msix_count,
GFP_KERNEL);
entries = kcalloc(ha->msix_count, sizeof(struct msix_entry),
GFP_KERNEL);
if (!entries) {
ql_log(ql_log_warn, vha, 0x00bc,
"Failed to allocate memory for msix_entry.\n");
@@ -2664,8 +2664,8 @@ msix_failed:
}
ha->max_rsp_queues = ha->msix_count - 1;
}
ha->msix_entries = kzalloc(sizeof(struct qla_msix_entry) *
ha->msix_count, GFP_KERNEL);
ha->msix_entries = kcalloc(ha->msix_count,
sizeof(struct qla_msix_entry), GFP_KERNEL);
if (!ha->msix_entries) {
ql_log(ql_log_fatal, vha, 0x00c8,
"Failed to allocate memory for ha->msix_entries.\n");

View File

@@ -367,7 +367,7 @@ static int qla2x00_alloc_queues(struct qla_hw_data *ha, struct req_que *req,
struct rsp_que *rsp)
{
scsi_qla_host_t *vha = pci_get_drvdata(ha->pdev);
ha->req_q_map = kzalloc(sizeof(struct req_que *) * ha->max_req_queues,
ha->req_q_map = kcalloc(ha->max_req_queues, sizeof(struct req_que *),
GFP_KERNEL);
if (!ha->req_q_map) {
ql_log(ql_log_fatal, vha, 0x003b,
@@ -375,7 +375,7 @@ static int qla2x00_alloc_queues(struct qla_hw_data *ha, struct req_que *req,
goto fail_req_map;
}
ha->rsp_q_map = kzalloc(sizeof(struct rsp_que *) * ha->max_rsp_queues,
ha->rsp_q_map = kcalloc(ha->max_rsp_queues, sizeof(struct rsp_que *),
GFP_KERNEL);
if (!ha->rsp_q_map) {
ql_log(ql_log_fatal, vha, 0x003c,
@@ -3286,8 +3286,9 @@ qla2x00_mem_alloc(struct qla_hw_data *ha, uint16_t req_len, uint16_t rsp_len,
#ifdef CONFIG_SCSI_QLA2XXX_TARGET
if (IS_FWI2_CAPABLE(ha)) {
ha->tgt_vp_map = kzalloc(sizeof(struct qla_tgt_vp_map) *
MAX_MULTI_ID_FABRIC, GFP_KERNEL);
ha->tgt_vp_map = kcalloc(MAX_MULTI_ID_FABRIC,
sizeof(struct qla_tgt_vp_map),
GFP_KERNEL);
if (!ha->tgt_vp_map)
goto fail_free_init_cb;
@@ -3433,8 +3434,9 @@ qla2x00_mem_alloc(struct qla_hw_data *ha, uint16_t req_len, uint16_t rsp_len,
(*rsp)->ring);
/* Allocate memory for NVRAM data for vports */
if (ha->nvram_npiv_size) {
ha->npiv_info = kzalloc(sizeof(struct qla_npiv_entry) *
ha->nvram_npiv_size, GFP_KERNEL);
ha->npiv_info = kcalloc(ha->nvram_npiv_size,
sizeof(struct qla_npiv_entry),
GFP_KERNEL);
if (!ha->npiv_info) {
ql_log_pci(ql_log_fatal, ha->pdev, 0x002d,
"Failed to allocate memory for npiv_info.\n");