Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp1942932ybi; Thu, 18 Jul 2019 00:46:23 -0700 (PDT) X-Google-Smtp-Source: APXvYqzcZhQFGCzaDpuI2FrAXWHjZ1szw0iYbGHw3HwYk037fDmMUGMPfxxpMYZK1FN93c98vgqe X-Received: by 2002:a17:902:2ae7:: with SMTP id j94mr48516081plb.270.1563435983766; Thu, 18 Jul 2019 00:46:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563435983; cv=none; d=google.com; s=arc-20160816; b=XsxhUINZ0Vf3R73CI6sERaVunQijWhEzEF22xf8Jph8fE55Yvzp1+xJ2C7XxPjmVFe WcYJsyiIEB3WHUSKxDmHkl1ZPpyQrOwEi6AqlnZrA3K0p+vJnokmMhdRUAfPvhmyga2b Wvf77AN2FC4KN4Fvo/8Xj3F56br1+py85mlUiH7d/10Kc2XOD7B8o3YyXF08CwfxWiO/ UVFKh0BIHXLgqdXiqyJXhxuqg2O9kD7zhEWoKe2fR8pBG4WEMs9s4jqb6B+T95sbE+4t bk12awQJoUyzZNgQM9MiBm9vS8NTDZjRuoTJ2oq18nCTmEFkDFbc5+2KRllDh9cqr5vs xFgw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:content-transfer-encoding:mime-version :message-id:date:subject:cc:from:dkim-signature; bh=jYg175Do8ulNmF1GihD7s07sa1JEEtvEBEJHzo1oiXs=; b=XnFyix/CALDZiPxWEoh8jCLkSMt1C8d35l74K0h0rLAppKSuNGqDQZUx14+Y/gkYUm IhG69ZPzdECcc0TisOP4rGLXNXiwu9vX7T07wmQ5SDEJxdQoz3nDtIVYjShFH/qdm9lt GPBxe2rxtK0Nu5Y+nBFc7Rr3ChQPa7P23W0z0pMwWL1NzUf1n8Die/QHThWmP82kOB9A /VVlgZPMpolwNmK9blEJ8JX+laEYR/o6w4u59LttIxTCPSMG1/hkoiSj9PtmgUs15MW4 5UV5olMeseJpXkDJGMoqxWxom252SQ8EJmn/5/8bodm77qVU2xhExO4LKxAzfs6pEIBn rfzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=U1xi765P; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g191si223683pgc.331.2019.07.18.00.46.07; Thu, 18 Jul 2019 00:46:23 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=U1xi765P; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389285AbfGRHpl (ORCPT + 99 others); Thu, 18 Jul 2019 03:45:41 -0400 Received: from mail-pg1-f195.google.com ([209.85.215.195]:40223 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726386AbfGRHpk (ORCPT ); Thu, 18 Jul 2019 03:45:40 -0400 Received: by mail-pg1-f195.google.com with SMTP id w10so12488039pgj.7; Thu, 18 Jul 2019 00:45:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=jYg175Do8ulNmF1GihD7s07sa1JEEtvEBEJHzo1oiXs=; b=U1xi765P5BHoCVO87bBSYGBNnHnNnLhMVvRX26T15rQit+QyLMQsVJmI5gO1jYh4+i SXGLCt2B/OgZwEsrlaZXfdOJQFeopTCjWrJYO6mbYnDCZJfnsIiAGgPd0mijuCYjfgvp CIodNtNHFgdlx+JuesbmiYhb5oY9iAl5ysdZoj+vT9M9GqdQ0L9StOHdMidHJk7O43FM E9WmXW6IrnIUoVC/CIy2ATn7en2FHBTM1YLfTn+uH31ylDE2Gb376kVEJBKgL//g6blj ZMniJVQ+JsUOGJ+tYPhUhVcmWhRFMyl5D2pGbMbDCEeptcSxwyIWv21awiOdYq94S/5E ZD5g== 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:mime-version :content-transfer-encoding; bh=jYg175Do8ulNmF1GihD7s07sa1JEEtvEBEJHzo1oiXs=; b=quhCIUXcYYxE/c9WVH0Fp2QvOVhUidNng9zzsv0ig5AFlbiqcrJJCD3Dbr+3z+v7eP 8f/TaioZKD1h2BW9b00FFbvK1FKeSAca582HBwMykA6tvmeLsXG8lHVSYbrPTAMCQbg8 4pumSnplnoyjRaEKzyJ79xB/DVSkuw5zOTYHgu31nsR+FppnkOOJLLB2HrwgsNfMvlU7 9pjmD5B7JozwWi/tnfd43ED5yJrmxDxP0FgHhYTp6xX4Yf9XpyvllRDQXPDh84pM2npu FKM0lfs2sJNKxV1MCCIFBkAoxJtXy/SFeyYG7m4Z625tdrIheTqS/N3SbZAtkWZ7tufE E13w== X-Gm-Message-State: APjAAAUvHncBxTmtv5KlAKVWMfbaEhrs+S1CCr5Ao3W3xSl55B7N41ZA NFB1UeGPq5POq9oMLhYPLX0= X-Received: by 2002:a65:6281:: with SMTP id f1mr43590875pgv.400.1563435940226; Thu, 18 Jul 2019 00:45:40 -0700 (PDT) Received: from suzukaze.ipads-lab.se.sjtu.edu.cn ([202.120.40.82]) by smtp.gmail.com with ESMTPSA id y128sm42349646pgy.41.2019.07.18.00.45.37 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Thu, 18 Jul 2019 00:45:39 -0700 (PDT) From: Chuhong Yuan Cc: qla2xxx-upstream@qlogic.com, "James E . J . Bottomley" , "Martin K . Petersen" , linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, Chuhong Yuan Subject: [PATCH 1/3] scsi: qla2xxx: Replace vmalloc + memset with vzalloc Date: Thu, 18 Jul 2019 15:45:18 +0800 Message-Id: <20190718074518.16273-1-hslester96@gmail.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit To: unlisted-recipients:; (no To-header on input) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use vzalloc instead of using vmalloc to allocate memory and then zeroing it with memset. This simplifies the code. Signed-off-by: Chuhong Yuan --- drivers/scsi/qla2xxx/qla_attr.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c index 8d560c562e9c..2b92d4659934 100644 --- a/drivers/scsi/qla2xxx/qla_attr.c +++ b/drivers/scsi/qla2xxx/qla_attr.c @@ -382,7 +382,7 @@ qla2x00_sysfs_write_optrom_ctl(struct file *filp, struct kobject *kobj, ha->optrom_region_size = size; ha->optrom_state = QLA_SREADING; - ha->optrom_buffer = vmalloc(ha->optrom_region_size); + ha->optrom_buffer = vzalloc(ha->optrom_region_size); if (ha->optrom_buffer == NULL) { ql_log(ql_log_warn, vha, 0x7062, "Unable to allocate memory for optrom retrieval " @@ -404,7 +404,6 @@ qla2x00_sysfs_write_optrom_ctl(struct file *filp, struct kobject *kobj, "Reading flash region -- 0x%x/0x%x.\n", ha->optrom_region_start, ha->optrom_region_size); - memset(ha->optrom_buffer, 0, ha->optrom_region_size); ha->isp_ops->read_optrom(vha, ha->optrom_buffer, ha->optrom_region_start, ha->optrom_region_size); break; @@ -457,7 +456,7 @@ qla2x00_sysfs_write_optrom_ctl(struct file *filp, struct kobject *kobj, ha->optrom_region_size = size; ha->optrom_state = QLA_SWRITING; - ha->optrom_buffer = vmalloc(ha->optrom_region_size); + ha->optrom_buffer = vzalloc(ha->optrom_region_size); if (ha->optrom_buffer == NULL) { ql_log(ql_log_warn, vha, 0x7066, "Unable to allocate memory for optrom update " @@ -472,7 +471,6 @@ qla2x00_sysfs_write_optrom_ctl(struct file *filp, struct kobject *kobj, "Staging flash region write -- 0x%x/0x%x.\n", ha->optrom_region_start, ha->optrom_region_size); - memset(ha->optrom_buffer, 0, ha->optrom_region_size); break; case 3: if (ha->optrom_state != QLA_SWRITING) { -- 2.20.1