From patchwork Wed Feb 14 19:52:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Souptick Joarder X-Patchwork-Id: 10219839 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D0D09601D7 for ; Wed, 14 Feb 2018 19:52:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A56CE29099 for ; Wed, 14 Feb 2018 19:52:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A3B152899C; Wed, 14 Feb 2018 19:52:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 30B8929099 for ; Wed, 14 Feb 2018 19:50:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1163085AbeBNTu5 (ORCPT ); Wed, 14 Feb 2018 14:50:57 -0500 Received: from mail-pl0-f67.google.com ([209.85.160.67]:35671 "EHLO mail-pl0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1162994AbeBNTu4 (ORCPT ); Wed, 14 Feb 2018 14:50:56 -0500 Received: by mail-pl0-f67.google.com with SMTP id o11so5489855pls.2 for ; Wed, 14 Feb 2018 11:50:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :user-agent; bh=Zqq0SYdvuELT/Vksxm6IV+3oCyRYH1hQOwCahQPBxVc=; b=oxokk5lPoJPw0oumS1pLo6I9dMWFx6twz0HF3bfEfMO/hFGHCm85O0uYDDI0JDNw7r eGAoAbzlXzfuRM0dozzILgquzWf8+qadYNccDrVuRX+S14ysHvlpUcAPR694/4Y7UDTU GeJgMrwF80Br5ukyNu0RI1uwTfJKbtS/+5WHBVQO97RyTQi1UlblC6i886/GXG0iz/1q 2Rd8qG9p8HupNLYRN6ELppO8E8xmW38oDNhoOLETAelsO8DqmT1iqNZmgd/yxbbiLljp yz4ryStodkazyx6ubWWu+bzjjHqjNIH51jA9wpCQ5/3o4J0Wy/6P9oUmIWweuW5Z3+uG qVgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:user-agent; bh=Zqq0SYdvuELT/Vksxm6IV+3oCyRYH1hQOwCahQPBxVc=; b=OxJMdJQJuInmC8lh80Hnmf8yN4aXZyidtdgPyu11DIVVNtR9DI3QDcuD9Wb8E9VmKq OHtL73zHKlOkTa/pItaNTYpGBaaTnVLfKJUXFbU16YwAmn9h8SWEA0FdZhNF/4UpNhtE d5XV5HBbozfJ/iHXIq9QQema3k2cBJZIUlfjXLUHC3GCIrvSLm63tkiQ0wNcIt7L6BTl H+NmaF0+BzR4F6xM2WIK8lhS9pc1eJXHL+Sbn7gmVu50Ntt+S7ODP0Dn1RRgvrd+3h4C DUpGZymqYUsjZdFAZnlLIByTpUz6DQ87CZM4oYa1YRamYmw+ukAj697wr1Qk4WvOOZ2S sPLQ== X-Gm-Message-State: APf1xPA1f4uSvQSAbbAcV310lK4hlY7kOCiyoT+WlwXh2pdycTR3/t4w wjU3glQoBPeMQ/M+PibJ7IJxqQ== X-Google-Smtp-Source: AH8x225d/4O9R6lHm3qthU57glaGnODMU6pjW+xdJcT2gVXnDLE1r+KiSBROA2A2Ks/pjMSsh97Zng== X-Received: by 2002:a17:902:b787:: with SMTP id e7-v6mr124758pls.317.1518637855292; Wed, 14 Feb 2018 11:50:55 -0800 (PST) Received: from jordon-HP-15-Notebook-PC ([49.205.216.37]) by smtp.gmail.com with ESMTPSA id 206sm43765361pfy.140.2018.02.14.11.50.52 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 14 Feb 2018 11:50:53 -0800 (PST) Date: Thu, 15 Feb 2018 01:22:13 +0530 From: Souptick Joarder To: qla2xxx-upstream@qlogic.com Cc: linux-scsi@vger.kernel.org Subject: [PATCH] scsi: qla2xxx: Use dma_pool_zalloc() Message-ID: <20180214195212.GA6291@jordon-HP-15-Notebook-PC> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Use dma_pool_zalloc() instead of dma_pool_alloc + memset Signed-off-by: Souptick Joarder --- drivers/scsi/qla2xxx/qla_bsg.c | 3 +-- drivers/scsi/qla2xxx/qla_iocb.c | 10 ++-------- drivers/scsi/qla2xxx/qla_target.c | 5 +---- 3 files changed, 4 insertions(+), 14 deletions(-) -- 1.9.1 diff --git a/drivers/scsi/qla2xxx/qla_bsg.c b/drivers/scsi/qla2xxx/qla_bsg.c index e2d5d3c..c11a89b 100644 --- a/drivers/scsi/qla2xxx/qla_bsg.c +++ b/drivers/scsi/qla2xxx/qla_bsg.c @@ -1035,7 +1035,7 @@ 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 @@ 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; diff --git a/drivers/scsi/qla2xxx/qla_iocb.c b/drivers/scsi/qla2xxx/qla_iocb.c index 1b62e94..1796866 100644 --- a/drivers/scsi/qla2xxx/qla_iocb.c +++ b/drivers/scsi/qla2xxx/qla_iocb.c @@ -1203,7 +1203,6 @@ struct fw_dif_context { 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; @@ -1245,15 +1244,11 @@ struct fw_dif_context { /* 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; @@ -3067,7 +3062,7 @@ struct fw_dif_context { } 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, @@ -3120,7 +3115,6 @@ struct fw_dif_context { 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; diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c index fc89af8..17ab939 100644 --- a/drivers/scsi/qla2xxx/qla_target.c +++ b/drivers/scsi/qla2xxx/qla_target.c @@ -2871,7 +2871,6 @@ static void qlt_24xx_init_ctio_to_isp(struct ctio7_to_24xx *ctio, 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,14 +2999,12 @@ static void qlt_24xx_init_ctio_to_isp(struct ctio7_to_24xx *ctio, /* 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);