scsi: qla2xxx: Use dma_pool_zalloc()
authorSouptick Joarder <jrdr.linux@gmail.com>
Wed, 14 Feb 2018 20:10:38 +0000 (01:40 +0530)
committerMartin K. Petersen <martin.petersen@oracle.com>
Fri, 23 Feb 2018 01:28:43 +0000 (20:28 -0500)
Use dma_pool_zalloc() instead of dma_pool_alloc + memset

Signed-off-by: Souptick Joarder <jrdr.linux@gmail.com>
Acked-by: Himanshu Madhani <himanshu.madhani@cavium.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/qla2xxx/qla_bsg.c
drivers/scsi/qla2xxx/qla_iocb.c
drivers/scsi/qla2xxx/qla_target.c

index e2d5d3ca0f57c57307b1cbf202f6e358f999801b..c11a89be292c83036a020442e3689181cb8e2809 100644 (file)
@@ -1035,7 +1035,7 @@ qla84xx_updatefw(struct bsg_job *bsg_job)
        sg_copy_to_buffer(bsg_job->request_payload.sg_list,
                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) {
                ql_log(ql_log_warn, vha, 0x7036,
                    "DMA alloc failed for fw buffer.\n");
@@ -1046,7 +1046,6 @@ qla84xx_updatefw(struct bsg_job *bsg_job)
        flag = bsg_request->rqst_data.h_vendor.vendor_cmd[1];
        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_count = 1;
 
index e62ccd9318535fe6f05a9795bfe59750431f4a1b..a4edbecfaf968f8ad56523d718539c7ca9494992 100644 (file)
@@ -1210,7 +1210,6 @@ qla24xx_build_scsi_crc_2_iocbs(srb_t *sp, struct cmd_type_crc_2 *cmd_pkt,
        uint32_t                dif_bytes;
        uint8_t                 bundling = 1;
        uint16_t                blk_size;
-       uint8_t                 *clr_ptr;
        struct crc_context      *crc_ctx_pkt = NULL;
        struct qla_hw_data      *ha;
        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,
 
        /* Allocate CRC context from global pool */
        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)
                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;
 
        sp->flags |= SRB_CRC_CTX_DMA_VALID;
@@ -3074,7 +3069,7 @@ sufficient_dsds:
                }
 
                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);
                if (!ctx->fcp_cmnd) {
                        ql_log(ql_log_fatal, vha, 0x3011,
@@ -3127,7 +3122,6 @@ sufficient_dsds:
                host_to_fcp_swap((uint8_t *)&cmd_pkt->lun, sizeof(cmd_pkt->lun));
 
                /* build FCP_CMND IU */
-               memset(ctx->fcp_cmnd, 0, sizeof(struct fcp_cmnd));
                int_to_scsilun(cmd->device->lun, &ctx->fcp_cmnd->lun);
                ctx->fcp_cmnd->additional_cdb_len = additional_cdb_len;
 
index 3735ebd8301272fa15e861032bf78ffa88d33eba..755d7a2a3eea069acdc276abdb40292257169d91 100644 (file)
@@ -2871,7 +2871,6 @@ qlt_build_ctio_crc2_pkt(struct qla_qpair *qpair, struct qla_tgt_prm *prm)
        uint32_t                data_bytes;
        uint32_t                dif_bytes;
        uint8_t                 bundling = 1;
-       uint8_t                 *clr_ptr;
        struct crc_context      *crc_ctx_pkt = NULL;
        struct qla_hw_data      *ha;
        struct ctio_crc2_to_fw  *pkt;
@@ -3000,15 +2999,11 @@ qlt_build_ctio_crc2_pkt(struct qla_qpair *qpair, struct qla_tgt_prm *prm)
 
        /* Allocate CRC context from global pool */
        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)
                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;
        INIT_LIST_HEAD(&crc_ctx_pkt->dsd_list);