From nobody Mon Apr 6 12:33:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9B1C0C6FA82 for ; Thu, 8 Sep 2022 01:37:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229899AbiIHBhJ (ORCPT ); Wed, 7 Sep 2022 21:37:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37822 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229541AbiIHBhE (ORCPT ); Wed, 7 Sep 2022 21:37:04 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 95910C6E84; Wed, 7 Sep 2022 18:37:03 -0700 (PDT) Received: from dggemv703-chm.china.huawei.com (unknown [172.30.72.57]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4MNM7M0wTrzZcKb; Thu, 8 Sep 2022 09:32:31 +0800 (CST) Received: from kwepemm600008.china.huawei.com (7.193.23.88) by dggemv703-chm.china.huawei.com (10.3.19.46) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Thu, 8 Sep 2022 09:37:01 +0800 Received: from huawei.com (10.175.100.227) by kwepemm600008.china.huawei.com (7.193.23.88) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Thu, 8 Sep 2022 09:37:00 +0800 From: Shang XiaoJing To: , , , , , , , , CC: Subject: [PATCH 1/4] perf trace: Use zalloc to save initialization of syscall_stats Date: Thu, 8 Sep 2022 10:11:38 +0800 Message-ID: <20220908021141.27134-2-shangxiaojing@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220908021141.27134-1-shangxiaojing@huawei.com> References: <20220908021141.27134-1-shangxiaojing@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.100.227] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To kwepemm600008.china.huawei.com (7.193.23.88) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" As most members of syscall_stats is set to 0 in thread__update_stats, using zalloc directly. Signed-off-by: Shang XiaoJing --- tools/perf/builtin-trace.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c index 0bd9d01c0df9..3ecc31375f90 100644 --- a/tools/perf/builtin-trace.c +++ b/tools/perf/builtin-trace.c @@ -2173,13 +2173,10 @@ static void thread__update_stats(struct thread *thr= ead, struct thread_trace *ttr =20 stats =3D inode->priv; if (stats =3D=3D NULL) { - stats =3D malloc(sizeof(*stats)); + stats =3D zalloc(sizeof(*stats)); if (stats =3D=3D NULL) return; =20 - stats->nr_failures =3D 0; - stats->max_errno =3D 0; - stats->errnos =3D NULL; init_stats(&stats->stats); inode->priv =3D stats; } --=20 2.17.1