From patchwork Sat Dec 30 15:28:31 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Himanshu Jha X-Patchwork-Id: 10137785 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 C00B160233 for ; Sat, 30 Dec 2017 15:30:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B3BD628776 for ; Sat, 30 Dec 2017 15:30:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A86EA2877F; Sat, 30 Dec 2017 15:30:59 +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=-3.7 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SBL_CSS autolearn=unavailable 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 5F27328776 for ; Sat, 30 Dec 2017 15:30:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751362AbdL3Pac (ORCPT ); Sat, 30 Dec 2017 10:30:32 -0500 Received: from mail-pl0-f66.google.com ([209.85.160.66]:41307 "EHLO mail-pl0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751177AbdL3Pa2 (ORCPT ); Sat, 30 Dec 2017 10:30:28 -0500 Received: by mail-pl0-f66.google.com with SMTP id g2so24591504pli.8; Sat, 30 Dec 2017 07:30:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=MpaDzzrw+n9pjaQztyGxRNJvxeiwkguYDsDWqufdKFk=; b=To2JGGYCn0iIAQNmFPFhv6YGHjV544+e8cOhUjic0Zk583Q8h1X4XHul85mMqB47pX ieRzujL1RZpJj4AgkWctWlk+xY/zIfa3SXlUJQ70NxlP7iXD+jk37tw0RWJtYAHjdB6Z g5pYlmgRSjbEY0vCB8F0uX9HtrXNQLeCg2UmpSHXdwuRs5wKD3LV1g2hNM9GSzcbJ4CD 2D+TyKWqrtcwsCV78UzUaxnznBv++XP2p1t+/Xk3pH5xX+E4V/wd4b3oaE13M9MIBCO+ cbOLD2Li4KREsy5YERYYCxi6nWXRXEKt6HPvclTBCMLwsgBdcO2qHHf+L+0mDiH/VnFG RPYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=MpaDzzrw+n9pjaQztyGxRNJvxeiwkguYDsDWqufdKFk=; b=jEYKoNFeExZv6p61Rrox3sW7DNUTUM3JXebv6u8n6zZ8HMJmroZqemayMAI/tztv+U QNspQYLH4nHS+KD+TfnrDCjhBlsM4ee/5NZ8mph6T2WCSRS/FD7MVfhJ7UAboCD5ng4t 5lO5n/v0YUWS6ZquodXaZF4WoHVyln2nrVNOhkDr44/XwVqKCV0Kq3T3WOoHf/hXoNA7 Z5Np/6LwvwR1xWlnhaNRNeU8Wp48hVVEmLNTMOkwjMFZeD13qHwkdVB7QD9+w0vnwTrO ogeKKNftyWJCPWoF59egvC0Z8767m4c/t+hv73QGupeEMDX8cieyierMySdU9LlSOQVS Fmyw== X-Gm-Message-State: AKGB3mKPUxVaoiqnns46TELZbuZMR90aocfoldvyxMSzYZLmb2ULDMGS WjclLsmDcbZq08WqToNgr9Q= X-Google-Smtp-Source: ACJfBovo6soGFqQn4kpeSL+msTITNbpGJA3M8vQGg/bvGwPCJfl0HoiBywBw//IExitiRSZCF0MBtA== X-Received: by 10.84.217.72 with SMTP id e8mr13001558plj.168.1514647827572; Sat, 30 Dec 2017 07:30:27 -0800 (PST) Received: from localhost.localdomain ([103.46.193.14]) by smtp.gmail.com with ESMTPSA id f79sm81933715pfd.45.2017.12.30.07.30.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 30 Dec 2017 07:30:26 -0800 (PST) From: Himanshu Jha To: jejb@linux.vnet.ibm.com, martin.petersen@oracle.com, aacraid@adaptec.com Cc: anil.gurumurthy@qlogic.com, sudarsana.kalluru@qlogic.com, QLogic-Storage-Upstream@qlogic.com, satishkh@cisco.com, sebaddel@cisco.com, kartilak@cisco.com, QLogic-Storage-Upstream@cavium.com, qla2xxx-upstream@qlogic.com, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, Himanshu Jha Subject: [PATCH 8/9] scsi: bfa: Use zeroing allocator rather than allocator/memset Date: Sat, 30 Dec 2017 20:58:31 +0530 Message-Id: <1514647712-6332-9-git-send-email-himanshujha199640@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1514647712-6332-1-git-send-email-himanshujha199640@gmail.com> References: <1514647712-6332-1-git-send-email-himanshujha199640@gmail.com> 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 vzalloc instead of vmalloc followed by memset 0. Generated-by: scripts/coccinelle/api/alloc/kzalloc-simple.cocci Suggested-by: Luis R. Rodriguez Signed-off-by: Himanshu Jha --- drivers/scsi/bfa/bfad.c | 3 +-- drivers/scsi/bfa/bfad_debugfs.c | 8 ++------ 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/scsi/bfa/bfad.c b/drivers/scsi/bfa/bfad.c index bac18f6..bd7e6a6f 100644 --- a/drivers/scsi/bfa/bfad.c +++ b/drivers/scsi/bfa/bfad.c @@ -610,13 +610,12 @@ bfad_hal_mem_alloc(struct bfad_s *bfad) /* Iterate through the KVA meminfo queue */ list_for_each(km_qe, &kva_info->qe) { kva_elem = (struct bfa_mem_kva_s *) km_qe; - kva_elem->kva = vmalloc(kva_elem->mem_len); + kva_elem->kva = vzalloc(kva_elem->mem_len); if (kva_elem->kva == NULL) { bfad_hal_mem_release(bfad); rc = BFA_STATUS_ENOMEM; goto ext; } - memset(kva_elem->kva, 0, kva_elem->mem_len); } /* Iterate through the DMA meminfo queue */ diff --git a/drivers/scsi/bfa/bfad_debugfs.c b/drivers/scsi/bfa/bfad_debugfs.c index 05f5239..349cfe7 100644 --- a/drivers/scsi/bfa/bfad_debugfs.c +++ b/drivers/scsi/bfa/bfad_debugfs.c @@ -81,7 +81,7 @@ bfad_debugfs_open_fwtrc(struct inode *inode, struct file *file) fw_debug->buffer_len = sizeof(struct bfa_trc_mod_s); - fw_debug->debug_buffer = vmalloc(fw_debug->buffer_len); + fw_debug->debug_buffer = vzalloc(fw_debug->buffer_len); if (!fw_debug->debug_buffer) { kfree(fw_debug); printk(KERN_INFO "bfad[%d]: Failed to allocate fwtrc buffer\n", @@ -89,8 +89,6 @@ bfad_debugfs_open_fwtrc(struct inode *inode, struct file *file) return -ENOMEM; } - memset(fw_debug->debug_buffer, 0, fw_debug->buffer_len); - spin_lock_irqsave(&bfad->bfad_lock, flags); rc = bfa_ioc_debug_fwtrc(&bfad->bfa.ioc, fw_debug->debug_buffer, @@ -125,7 +123,7 @@ bfad_debugfs_open_fwsave(struct inode *inode, struct file *file) fw_debug->buffer_len = sizeof(struct bfa_trc_mod_s); - fw_debug->debug_buffer = vmalloc(fw_debug->buffer_len); + fw_debug->debug_buffer = vzalloc(fw_debug->buffer_len); if (!fw_debug->debug_buffer) { kfree(fw_debug); printk(KERN_INFO "bfad[%d]: Failed to allocate fwsave buffer\n", @@ -133,8 +131,6 @@ bfad_debugfs_open_fwsave(struct inode *inode, struct file *file) return -ENOMEM; } - memset(fw_debug->debug_buffer, 0, fw_debug->buffer_len); - spin_lock_irqsave(&bfad->bfad_lock, flags); rc = bfa_ioc_debug_fwsave(&bfad->bfa.ioc, fw_debug->debug_buffer,