Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

perf callchain: Remove unneeded 'result' variable

Return the value scnprintf() directly instead of storing it in a
redundant variable.

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: ye xingchen <ye.xingchen@zte.com.cn>
Cc: Alexandre Truong <alexandre.truong@arm.com>
Cc: Ian Rogers <irogers@google.com>
Cc: James Clark <james.clark@arm.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

ye xingchen and committed by
Arnaldo Carvalho de Melo
016f2f98 cf874a01

+2 -10
+2 -10
tools/perf/util/callchain.c
··· 1307 1307 1308 1308 static int count_pri64_printf(int idx, const char *str, u64 value, char *bf, int bfsize) 1309 1309 { 1310 - int printed; 1311 - 1312 - printed = scnprintf(bf, bfsize, "%s%s:%" PRId64 "", (idx) ? " " : " (", str, value); 1313 - 1314 - return printed; 1310 + return scnprintf(bf, bfsize, "%s%s:%" PRId64 "", (idx) ? " " : " (", str, value); 1315 1311 } 1316 1312 1317 1313 static int count_float_printf(int idx, const char *str, float value, 1318 1314 char *bf, int bfsize, float threshold) 1319 1315 { 1320 - int printed; 1321 - 1322 1316 if (threshold != 0.0 && value < threshold) 1323 1317 return 0; 1324 1318 1325 - printed = scnprintf(bf, bfsize, "%s%s:%.1f%%", (idx) ? " " : " (", str, value); 1326 - 1327 - return printed; 1319 + return scnprintf(bf, bfsize, "%s%s:%.1f%%", (idx) ? " " : " (", str, value); 1328 1320 } 1329 1321 1330 1322 static int branch_to_str(char *bf, int bfsize,