Commit e3e7572f authored by Shang XiaoJing's avatar Shang XiaoJing Committed by Arnaldo Carvalho de Melo

perf trace: Use zalloc() to save initialization of syscall_stats

As most members of syscall_stats is set to 0 in thread__update_stats,
using zalloc() directly.
Signed-off-by: default avatarShang XiaoJing <shangxiaojing@huawei.com>
Acked-by: default avatarNamhyung Kim <namhyung@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: https://lore.kernel.org/r/20220908021141.27134-2-shangxiaojing@huawei.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent c581e46b
...@@ -2173,13 +2173,10 @@ static void thread__update_stats(struct thread *thread, struct thread_trace *ttr ...@@ -2173,13 +2173,10 @@ static void thread__update_stats(struct thread *thread, struct thread_trace *ttr
stats = inode->priv; stats = inode->priv;
if (stats == NULL) { if (stats == NULL) {
stats = malloc(sizeof(*stats)); stats = zalloc(sizeof(*stats));
if (stats == NULL) if (stats == NULL)
return; return;
stats->nr_failures = 0;
stats->max_errno = 0;
stats->errnos = NULL;
init_stats(&stats->stats); init_stats(&stats->stats);
inode->priv = stats; inode->priv = stats;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment