From patchwork Thu Dec 22 12:12:58 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Souptick Joarder X-Patchwork-Id: 9484731 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 B9A8D601D2 for ; Thu, 22 Dec 2016 12:13:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9E3D328179 for ; Thu, 22 Dec 2016 12:13:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9280828427; Thu, 22 Dec 2016 12:13:51 +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=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID 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 35BD128174 for ; Thu, 22 Dec 2016 12:13:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S938835AbcLVMNu (ORCPT ); Thu, 22 Dec 2016 07:13:50 -0500 Received: from mail-pg0-f65.google.com ([74.125.83.65]:34767 "EHLO mail-pg0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S938786AbcLVMNt (ORCPT ); Thu, 22 Dec 2016 07:13:49 -0500 Received: by mail-pg0-f65.google.com with SMTP id b1so19951440pgc.1 for ; Thu, 22 Dec 2016 04:13:01 -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=x8TuDjd0nwpJnZKss7xg0IcHXogOn3TofoaI0sg9ud4=; b=tSD3BvqLwvEDHN/sFiNc1emYbh72vr3uVFU3rarNs1qvEwQ/91rEF1flMKgEVe1UeA GFZ+v/utkP2Tn+drz7nvA04wmSjtRRpF2P5zoDzekzGnbUiRWsk+B68kUiHKCYPkT+Sa 4O0M/D2cvJufoOyL63W7D6mScv8n62rcft/YylU9TrYZh+uI+yw2+PTuJ4uTCSWSYTy8 Y64adQNEaGhZscCnAHq8XOtHVhQmcJWalKjlARhc5yYgPID8PwiHYsNCB+vt96A5W9B+ I8h8+W54P8+pqY6FvO6GM/7VIYzuc3Q643ah/9oaNsxTY6/GL4DjV6bDQ+KJTATmYWUn tO5w== 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=x8TuDjd0nwpJnZKss7xg0IcHXogOn3TofoaI0sg9ud4=; b=TBgggDZBtNbwn6TuNUPh7OuGzs0iSnXl+t1Tor3/xwk2Ugagn9bHaYswP+NOaWnL7l rarupqUpfeUZWXSAPsGblcCTE3wI/Hdmlk9p77+ANy6lYTevpa61PqpYKHDsAW2fCJC6 abGSs5NQjVbgJfgnR/x2CEv5Zx0ABRiQTL27Lq6Lreed01iHucIaXE4jsA6roSQ8KQOQ 6nr+E4/H1Pjrfq7SzOkzfrKvJCUiRGkfYDTc1FsAvYGJjXfxkImkJGMBq49gQG8Mzn4F JETffzG0oc2VWAB5yXr0nKAESSekkKf9NeFDsvS6uQ7B6f53vT19h2Rywf0NhVklimsp nejg== X-Gm-Message-State: AIkVDXJeVd9WS3cpgxYG05tI7xmsLCj4JXZuXOh5wj47yZUFOlIjixaRKK/TDMMpW8IWMQ== X-Received: by 10.84.218.3 with SMTP id q3mr18788133pli.80.1482408781135; Thu, 22 Dec 2016 04:13:01 -0800 (PST) Received: from gnr743-HP-ZBook-15 ([223.31.70.102]) by smtp.gmail.com with ESMTPSA id q23sm6470654pfg.47.2016.12.22.04.13.00 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 22 Dec 2016 04:13:00 -0800 (PST) Date: Thu, 22 Dec 2016 17:42:58 +0530 From: Souptick Joarder To: Nilesh.Javali@cavium.com, QLogic-Storage-Upstream@qlogic.com Cc: linux-scsi@vger.kernel.org, sahu.rameshwar73@gmail.com Subject: [PATCH v2] scsi: qla4xxx: Use dma_pool_zalloc Message-ID: <20161222121258.GA8278@gnr743-HP-ZBook-15> 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 We should use dma_pool_zalloc instead of dma_pool_alloc/memset Signed-off-by: Souptick joarder --- v2 changes: - Address comment from Nilesh to make same change in all applicable places inside qla4xxx source drivers/scsi/qla4xxx/ql4_mbx.c | 6 ++---- drivers/scsi/qla4xxx/ql4_os.c | 4 +--- 2 files changed, 3 insertions(+), 7 deletions(-) -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/scsi/qla4xxx/ql4_mbx.c b/drivers/scsi/qla4xxx/ql4_mbx.c index c291fdf..8f97839 100644 --- a/drivers/scsi/qla4xxx/ql4_mbx.c +++ b/drivers/scsi/qla4xxx/ql4_mbx.c @@ -1587,12 +1587,11 @@ int qla4xxx_get_chap(struct scsi_qla_host *ha, char *username, char *password, struct ql4_chap_table *chap_table; dma_addr_t chap_dma; - chap_table = dma_pool_alloc(ha->chap_dma_pool, GFP_KERNEL, &chap_dma); + chap_table = dma_pool_zalloc(ha->chap_dma_pool, GFP_KERNEL, &chap_dma); if (chap_table == NULL) return -ENOMEM; chap_size = sizeof(struct ql4_chap_table); - memset(chap_table, 0, chap_size); if (is_qla40XX(ha)) offset = FLASH_CHAP_OFFSET | (idx * chap_size); @@ -1651,13 +1650,12 @@ int qla4xxx_set_chap(struct scsi_qla_host *ha, char *username, char *password, uint32_t chap_size = 0; dma_addr_t chap_dma; - chap_table = dma_pool_alloc(ha->chap_dma_pool, GFP_KERNEL, &chap_dma); + chap_table = dma_pool_zalloc(ha->chap_dma_pool, GFP_KERNEL, &chap_dma); if (chap_table == NULL) { ret = -ENOMEM; goto exit_set_chap; } - memset(chap_table, 0, sizeof(struct ql4_chap_table)); if (bidi) chap_table->flags |= BIT_6; /* peer */ else diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c index 01c3610..0c91c89 100644 --- a/drivers/scsi/qla4xxx/ql4_os.c +++ b/drivers/scsi/qla4xxx/ql4_os.c @@ -825,12 +825,10 @@ static int qla4xxx_delete_chap(struct Scsi_Host *shost, uint16_t chap_tbl_idx) uint32_t chap_size; int ret = 0; - chap_table = dma_pool_alloc(ha->chap_dma_pool, GFP_KERNEL, &chap_dma); + chap_table = dma_pool_zalloc(ha->chap_dma_pool, GFP_KERNEL, &chap_dma); if (chap_table == NULL) return -ENOMEM; - memset(chap_table, 0, sizeof(struct ql4_chap_table)); - if (is_qla80XX(ha)) max_chap_entries = (ha->hw.flt_chap_size / 2) / sizeof(struct ql4_chap_table);