From patchwork Sat May 27 18:06:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 99854 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp501550vqr; Sat, 27 May 2023 11:09:23 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4DYsF/YnQIHbEzrdbYVZsdSrHVorwaIgaZp5iohisZGiQ2j3BiwzbReXeIH/XfKIjADGLJ X-Received: by 2002:a05:6a00:1742:b0:647:157b:cb61 with SMTP id j2-20020a056a00174200b00647157bcb61mr3459416pfc.7.1685210962964; Sat, 27 May 2023 11:09:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685210962; cv=none; d=google.com; s=arc-20160816; b=YX/Bw9uvh2JmdF8eNJ7zn1AKSShIm9/Oq3dmN1LSjobBy7OwOC6o7CoVAzIA2vU/qE RDxIZ0clDNNkzUN25cnxzahFhX4T91HFHWeypNtutPJmBoyxZPAw2Dndd9EU7pSEJi81 2HQAw0YQEsOR8QsTiIGgpiR3f/q98/x8Is6A5KmM3rhYdcICuyBDs8YlDKryuvdc/BK8 0QalZbEA+b6dPfd80B9To/Ou7C/kcsM8v2L4eDFYCDYrydOq1p1XeE5yrNIXTVhoGtoN DVDkfdiqGwOQElZv3L3fqtMYeUERTY+94gEqF0b5Svbombxi+YmvyqrZDKDBEX8BBPzy HU7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=LJo0suhqS2HfE3uE26k/aOFLowEtiIxwmm1VGEPy9mU=; b=NFcp9ourfGbwz4Zp7NHxemMowc4KxZWiKO8B7zwkhU3EoI77GnLIaEpbZ4mbQ6bCuv qwKrLSDPmsllDePoul9JXBwsyX44ptaUAVVJX2pfvifiSnEjl/gilFYxKbWqTJpsqk/t rLbsx6X722zUb2LdcybPsabmHq+t7hF+OKBjfARmUHhj1kYIcfii+s3xqryb7INH4UJm e6p2pCbu6ehdQ9Z4Bi5QgSwZfN+0KyTbumWSUpPUnNbwLOtlZc12OvDd50nzw6/anv1H vghqgl5j02nHjFeePsqdZ6NaJScpaKhccvLzM1a/F/F6kbxpa7wf/TuqTtM+7BOhP/S+ 6Fow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b="GtlK9/SB"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d74-20020a63364d000000b0053ef547263csi63711pga.398.2023.05.27.11.09.11; Sat, 27 May 2023 11:09:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b="GtlK9/SB"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229501AbjE0SGy (ORCPT + 99 others); Sat, 27 May 2023 14:06:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37734 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229498AbjE0SGw (ORCPT ); Sat, 27 May 2023 14:06:52 -0400 Received: from smtp.smtpout.orange.fr (smtp-24.smtpout.orange.fr [80.12.242.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9D1FAD8 for ; Sat, 27 May 2023 11:06:45 -0700 (PDT) Received: from pop-os.home ([86.243.2.178]) by smtp.orange.fr with ESMTPA id 2yJMqqEHp8aX92yJMqPEHz; Sat, 27 May 2023 20:06:44 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1685210804; bh=LJo0suhqS2HfE3uE26k/aOFLowEtiIxwmm1VGEPy9mU=; h=From:To:Cc:Subject:Date; b=GtlK9/SBhQJvW/RLCYpHPWPXzFqNL8XuXBBiKHP1H2vkKfA31txL/BLtCSyJRT8ej rmFEyhSfEvKEj/UcNlGPKmndDT/d9FXM+wWhqdYDrdzIZeOCkVwnJxbrENX0ZdlD9r ZXI4ERzvBEAWEhF9mFAYelsTMSf9w8G3kWLGa0NAcHtisIQEnDD/zFSgUzBz7QMifd aeGM16vRAZeeCYQ6zyPe5c5CaqI47wjWFWtOKhzSGZNvWueBZcPnE/j9h/0W28EaeN VCP+RAPPolitHxKpjtxiQOReUwU9YzoEGZQVHoJ1BaaX7am+g13Tn7iQl+NKZ/YUea W9CKSq0eZ8VkQ== X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Sat, 27 May 2023 20:06:44 +0200 X-ME-IP: 86.243.2.178 From: Christophe JAILLET To: Satish Kharat , Sesidhar Baddela , Karan Tilak Kumar , "James E.J. Bottomley" , "Martin K. Petersen" Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , linux-scsi@vger.kernel.org Subject: [PATCH] scsi: fnic: Use vzalloc() Date: Sat, 27 May 2023 20:06:37 +0200 Message-Id: X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Spam-Status: No, score=-0.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,FORGED_SPF_HELO,RCVD_IN_DNSWL_NONE,SPF_HELO_PASS, T_SCC_BODY_TEXT_LINE,T_SPF_TEMPERROR autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767071771045241191?= X-GMAIL-MSGID: =?utf-8?q?1767071771045241191?= Use vzalloc() instead of hand writing it with vmalloc()+memset(). This is less verbose. This also fixes some style issues :) Signed-off-by: Christophe JAILLET --- drivers/scsi/fnic/fnic_debugfs.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/scsi/fnic/fnic_debugfs.c b/drivers/scsi/fnic/fnic_debugfs.c index 6fedc3b7d1ab..c4d9ed0d7d75 100644 --- a/drivers/scsi/fnic/fnic_debugfs.c +++ b/drivers/scsi/fnic/fnic_debugfs.c @@ -201,25 +201,21 @@ static int fnic_trace_debugfs_open(struct inode *inode, return -ENOMEM; if (*rdata_ptr == fc_trc_flag->fnic_trace) { - fnic_dbg_prt->buffer = vmalloc(array3_size(3, trace_max_pages, + fnic_dbg_prt->buffer = vzalloc(array3_size(3, trace_max_pages, PAGE_SIZE)); if (!fnic_dbg_prt->buffer) { kfree(fnic_dbg_prt); return -ENOMEM; } - memset((void *)fnic_dbg_prt->buffer, 0, - 3 * (trace_max_pages * PAGE_SIZE)); fnic_dbg_prt->buffer_len = fnic_get_trace_data(fnic_dbg_prt); } else { fnic_dbg_prt->buffer = - vmalloc(array3_size(3, fnic_fc_trace_max_pages, + vzalloc(array3_size(3, fnic_fc_trace_max_pages, PAGE_SIZE)); if (!fnic_dbg_prt->buffer) { kfree(fnic_dbg_prt); return -ENOMEM; } - memset((void *)fnic_dbg_prt->buffer, 0, - 3 * (fnic_fc_trace_max_pages * PAGE_SIZE)); fnic_dbg_prt->buffer_len = fnic_fc_trace_get_data(fnic_dbg_prt, *rdata_ptr); }