Commit 501017f6 authored by Souptick Joarder's avatar Souptick Joarder Committed by Martin K. Petersen

scsi: qla2xxx: Use dma_pool_zalloc()

Use dma_pool_zalloc() instead of dma_pool_alloc + memset
Signed-off-by: default avatarSouptick Joarder <jrdr.linux@gmail.com>
Acked-by: default avatarHimanshu Madhani <himanshu.madhani@cavium.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 8d35a9dc
...@@ -1035,7 +1035,7 @@ qla84xx_updatefw(struct bsg_job *bsg_job) ...@@ -1035,7 +1035,7 @@ qla84xx_updatefw(struct bsg_job *bsg_job)
sg_copy_to_buffer(bsg_job->request_payload.sg_list, sg_copy_to_buffer(bsg_job->request_payload.sg_list,
bsg_job->request_payload.sg_cnt, fw_buf, data_len); bsg_job->request_payload.sg_cnt, fw_buf, data_len);
mn = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, &mn_dma); mn = dma_pool_zalloc(ha->s_dma_pool, GFP_KERNEL, &mn_dma);
if (!mn) { if (!mn) {
ql_log(ql_log_warn, vha, 0x7036, ql_log(ql_log_warn, vha, 0x7036,
"DMA alloc failed for fw buffer.\n"); "DMA alloc failed for fw buffer.\n");
...@@ -1046,7 +1046,6 @@ qla84xx_updatefw(struct bsg_job *bsg_job) ...@@ -1046,7 +1046,6 @@ qla84xx_updatefw(struct bsg_job *bsg_job)
flag = bsg_request->rqst_data.h_vendor.vendor_cmd[1]; flag = bsg_request->rqst_data.h_vendor.vendor_cmd[1];
fw_ver = le32_to_cpu(*((uint32_t *)((uint32_t *)fw_buf + 2))); fw_ver = le32_to_cpu(*((uint32_t *)((uint32_t *)fw_buf + 2)));
memset(mn, 0, sizeof(struct access_chip_84xx));
mn->entry_type = VERIFY_CHIP_IOCB_TYPE; mn->entry_type = VERIFY_CHIP_IOCB_TYPE;
mn->entry_count = 1; mn->entry_count = 1;
......
...@@ -1210,7 +1210,6 @@ qla24xx_build_scsi_crc_2_iocbs(srb_t *sp, struct cmd_type_crc_2 *cmd_pkt, ...@@ -1210,7 +1210,6 @@ qla24xx_build_scsi_crc_2_iocbs(srb_t *sp, struct cmd_type_crc_2 *cmd_pkt,
uint32_t dif_bytes; uint32_t dif_bytes;
uint8_t bundling = 1; uint8_t bundling = 1;
uint16_t blk_size; uint16_t blk_size;
uint8_t *clr_ptr;
struct crc_context *crc_ctx_pkt = NULL; struct crc_context *crc_ctx_pkt = NULL;
struct qla_hw_data *ha; struct qla_hw_data *ha;
uint8_t additional_fcpcdb_len; uint8_t additional_fcpcdb_len;
...@@ -1252,15 +1251,11 @@ qla24xx_build_scsi_crc_2_iocbs(srb_t *sp, struct cmd_type_crc_2 *cmd_pkt, ...@@ -1252,15 +1251,11 @@ qla24xx_build_scsi_crc_2_iocbs(srb_t *sp, struct cmd_type_crc_2 *cmd_pkt,
/* Allocate CRC context from global pool */ /* Allocate CRC context from global pool */
crc_ctx_pkt = sp->u.scmd.ctx = crc_ctx_pkt = sp->u.scmd.ctx =
dma_pool_alloc(ha->dl_dma_pool, GFP_ATOMIC, &crc_ctx_dma); dma_pool_zalloc(ha->dl_dma_pool, GFP_ATOMIC, &crc_ctx_dma);
if (!crc_ctx_pkt) if (!crc_ctx_pkt)
goto crc_queuing_error; goto crc_queuing_error;
/* Zero out CTX area. */
clr_ptr = (uint8_t *)crc_ctx_pkt;
memset(clr_ptr, 0, sizeof(*crc_ctx_pkt));
crc_ctx_pkt->crc_ctx_dma = crc_ctx_dma; crc_ctx_pkt->crc_ctx_dma = crc_ctx_dma;
sp->flags |= SRB_CRC_CTX_DMA_VALID; sp->flags |= SRB_CRC_CTX_DMA_VALID;
...@@ -3074,7 +3069,7 @@ qla82xx_start_scsi(srb_t *sp) ...@@ -3074,7 +3069,7 @@ qla82xx_start_scsi(srb_t *sp)
} }
memset(ctx, 0, sizeof(struct ct6_dsd)); memset(ctx, 0, sizeof(struct ct6_dsd));
ctx->fcp_cmnd = dma_pool_alloc(ha->fcp_cmnd_dma_pool, ctx->fcp_cmnd = dma_pool_zalloc(ha->fcp_cmnd_dma_pool,
GFP_ATOMIC, &ctx->fcp_cmnd_dma); GFP_ATOMIC, &ctx->fcp_cmnd_dma);
if (!ctx->fcp_cmnd) { if (!ctx->fcp_cmnd) {
ql_log(ql_log_fatal, vha, 0x3011, ql_log(ql_log_fatal, vha, 0x3011,
...@@ -3127,7 +3122,6 @@ qla82xx_start_scsi(srb_t *sp) ...@@ -3127,7 +3122,6 @@ qla82xx_start_scsi(srb_t *sp)
host_to_fcp_swap((uint8_t *)&cmd_pkt->lun, sizeof(cmd_pkt->lun)); host_to_fcp_swap((uint8_t *)&cmd_pkt->lun, sizeof(cmd_pkt->lun));
/* build FCP_CMND IU */ /* build FCP_CMND IU */
memset(ctx->fcp_cmnd, 0, sizeof(struct fcp_cmnd));
int_to_scsilun(cmd->device->lun, &ctx->fcp_cmnd->lun); int_to_scsilun(cmd->device->lun, &ctx->fcp_cmnd->lun);
ctx->fcp_cmnd->additional_cdb_len = additional_cdb_len; ctx->fcp_cmnd->additional_cdb_len = additional_cdb_len;
......
...@@ -2871,7 +2871,6 @@ qlt_build_ctio_crc2_pkt(struct qla_qpair *qpair, struct qla_tgt_prm *prm) ...@@ -2871,7 +2871,6 @@ qlt_build_ctio_crc2_pkt(struct qla_qpair *qpair, struct qla_tgt_prm *prm)
uint32_t data_bytes; uint32_t data_bytes;
uint32_t dif_bytes; uint32_t dif_bytes;
uint8_t bundling = 1; uint8_t bundling = 1;
uint8_t *clr_ptr;
struct crc_context *crc_ctx_pkt = NULL; struct crc_context *crc_ctx_pkt = NULL;
struct qla_hw_data *ha; struct qla_hw_data *ha;
struct ctio_crc2_to_fw *pkt; struct ctio_crc2_to_fw *pkt;
...@@ -3000,15 +2999,11 @@ qlt_build_ctio_crc2_pkt(struct qla_qpair *qpair, struct qla_tgt_prm *prm) ...@@ -3000,15 +2999,11 @@ qlt_build_ctio_crc2_pkt(struct qla_qpair *qpair, struct qla_tgt_prm *prm)
/* Allocate CRC context from global pool */ /* Allocate CRC context from global pool */
crc_ctx_pkt = cmd->ctx = crc_ctx_pkt = cmd->ctx =
dma_pool_alloc(ha->dl_dma_pool, GFP_ATOMIC, &crc_ctx_dma); dma_pool_zalloc(ha->dl_dma_pool, GFP_ATOMIC, &crc_ctx_dma);
if (!crc_ctx_pkt) if (!crc_ctx_pkt)
goto crc_queuing_error; goto crc_queuing_error;
/* Zero out CTX area. */
clr_ptr = (uint8_t *)crc_ctx_pkt;
memset(clr_ptr, 0, sizeof(*crc_ctx_pkt));
crc_ctx_pkt->crc_ctx_dma = crc_ctx_dma; crc_ctx_pkt->crc_ctx_dma = crc_ctx_dma;
INIT_LIST_HEAD(&crc_ctx_pkt->dsd_list); INIT_LIST_HEAD(&crc_ctx_pkt->dsd_list);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment