Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp1155256pxp; Sat, 12 Mar 2022 03:18:05 -0800 (PST) X-Google-Smtp-Source: ABdhPJw/jsMxOsTDbRNW/amjxB65aveZHsEcGQbkbL1SNmelzzMrf49XpTzpCXgXs8dB5W/qxiyR X-Received: by 2002:a17:906:fc10:b0:6cd:84e:7248 with SMTP id ov16-20020a170906fc1000b006cd084e7248mr12179748ejb.281.1647083885523; Sat, 12 Mar 2022 03:18:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1647083885; cv=none; d=google.com; s=arc-20160816; b=lAPiChJ87vmhcIQf4foKgCDRinxDgHuOt2RHxrxvKKQrDyc+e6Stnt7X8nOPe0qsIO k2wvqBl1Md7YWFksrP+lrbJyIizoP1ZPUiA5BA+TQ225OsQs9s4T933scxDvYQMKhO4c ZJyEjw7KwfLd+VrqxeyqYcuz+dbIpi1MPTvqME3iA4ZOPHF8LLiTOC1xMIgA5RYcn6D5 R1ZtT2oafc8AFc5R6e9xvl6ftNrwxI+i22UyLSgB1NuJdg+71Dzc6zQOsvD1qd0oRg9I Y1GIOj7eK9f2siXzbXZhKYXV7WLA6AuCcEZ5WIuND+fTPVICU89GJSMY/mqBLR0REryM C+Xg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=e5B8WLnGeGxNelCPBu35HFjirj5Rn9KY1Jc9NSO7c+8=; b=gD+WpS9S7TU7TKJzlDhjKnMOkhQiODI2I6RvsyEI3OxVPJ/wLo360Mt8MGwJ+vr6hj pfnulQuMskSeLqFa6VrIyGw9gXnp6amhiaDkHUBtXfa77xc3fULkS0yOefaZM5hh5LAo JSTnzAShWNm2YAX2kDrm9n0JhMEkhhNJ1HLM1u6vVdmwF7oZtyIH5wRXiMtv/R1d+JWT 9dBU0XvVtQwJdPrADNSLmOGu6DwvMFI5TNWa7qrEWziec3F/Y8d2zz9CdfSQ0hbsByVb 5dSAXNmeJfj/dRM5hM1/72i9PCAswfYYVUvLkxri5grGhCHI5Jy/LBR+8r1pDFkfZO3u RoLQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@inria.fr header.s=dc header.b="hx3/hp1h"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=inria.fr Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dm2-20020a170907948200b006d7097f5b56si6327411ejc.229.2022.03.12.03.17.41; Sat, 12 Mar 2022 03:18:05 -0800 (PST) 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=@inria.fr header.s=dc header.b="hx3/hp1h"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=inria.fr Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229936AbiCLK2e (ORCPT + 99 others); Sat, 12 Mar 2022 05:28:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47474 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231742AbiCLK2X (ORCPT ); Sat, 12 Mar 2022 05:28:23 -0500 Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 25E671E6972; Sat, 12 Mar 2022 02:27:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=inria.fr; s=dc; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=e5B8WLnGeGxNelCPBu35HFjirj5Rn9KY1Jc9NSO7c+8=; b=hx3/hp1hBR3Ukjh+9CGEmElIJ6kMvnEnDOiAt58ECguIen7ZsR799zDv 3D9C6WMmLfKLKkNvXur8YHmz+HpmuAOcqW+HWE/gDgBOaMJe+2Ldushgm L2jucx+qkcOGSSJUV0+Y9DvDHzFUJznTAFr9d9j6AE15ull5qGPH2m/G1 Y=; Authentication-Results: mail2-relais-roc.national.inria.fr; dkim=none (message not signed) header.i=none; spf=SoftFail smtp.mailfrom=Julia.Lawall@inria.fr; dmarc=fail (p=none dis=none) d=inria.fr X-IronPort-AV: E=Sophos;i="5.90,175,1643670000"; d="scan'208";a="25781350" Received: from i80.paris.inria.fr (HELO i80.paris.inria.fr.) ([128.93.90.48]) by mail2-relais-roc.national.inria.fr with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Mar 2022 11:27:11 +0100 From: Julia Lawall To: James Smart Cc: kernel-janitors@vger.kernel.org, Dick Kennedy , "James E.J. Bottomley" , "Martin K. Petersen" , linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 4/6] scsi: lpfc: use kzalloc Date: Sat, 12 Mar 2022 11:27:03 +0100 Message-Id: <20220312102705.71413-5-Julia.Lawall@inria.fr> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220312102705.71413-1-Julia.Lawall@inria.fr> References: <20220312102705.71413-1-Julia.Lawall@inria.fr> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham 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 Use kzalloc instead of kmalloc + memset. The semantic patch that makes this change is: (https://coccinelle.gitlabpages.inria.fr/website/) // @@ expression res, size, flag; @@ - res = kmalloc(size, flag); + res = kzalloc(size, flag); ... - memset(res, 0, size); // Signed-off-by: Julia Lawall --- drivers/scsi/lpfc/lpfc_debugfs.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/scsi/lpfc/lpfc_debugfs.c b/drivers/scsi/lpfc/lpfc_debugfs.c index 30fac2f6fb06..7c4a71703065 100644 --- a/drivers/scsi/lpfc/lpfc_debugfs.c +++ b/drivers/scsi/lpfc/lpfc_debugfs.c @@ -6272,10 +6272,8 @@ lpfc_debugfs_initialize(struct lpfc_vport *vport) phba->hba_debugfs_root, phba, &lpfc_debugfs_op_slow_ring_trc); if (!phba->slow_ring_trc) { - phba->slow_ring_trc = kmalloc( - (sizeof(struct lpfc_debugfs_trc) * - lpfc_debugfs_max_slow_ring_trc), - GFP_KERNEL); + phba->slow_ring_trc = kzalloc((sizeof(struct lpfc_debugfs_trc) * lpfc_debugfs_max_slow_ring_trc), + GFP_KERNEL); if (!phba->slow_ring_trc) { lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT, "0416 Cannot create debugfs " @@ -6283,9 +6281,6 @@ lpfc_debugfs_initialize(struct lpfc_vport *vport) goto debug_failed; } atomic_set(&phba->slow_ring_trc_cnt, 0); - memset(phba->slow_ring_trc, 0, - (sizeof(struct lpfc_debugfs_trc) * - lpfc_debugfs_max_slow_ring_trc)); } snprintf(name, sizeof(name), "nvmeio_trc");