[PATCH v1 42/48] perf diff: Silence -Wshorten-64-to-32 warnings

Ian Rogers
2025-04-01T18:26:02Z

tools/perf/builtin-diff.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/tools/perf/builtin-diff.c b/tools/perf/builtin-diff.c
index ae490d58af92..9c21ea8f242a 100644
--- a/tools/perf/builtin-diff.c
+++ b/tools/perf/builtin-diff.c
@@ -243,7 +243,7 @@ static int setup_compute(const struct option *opt, const char *str,

option = strchr(str, ':');
if (option) {
- unsigned len = option++ - str;
+ size_t len = option++ - str;

/*
* The str data are not writeable, so we need
@@ -1148,7 +1148,7 @@ static int check_file_brstack(void)
d->session = perf_session__new(&d->data, &pdiff.tool);
if (IS_ERR(d->session)) {
pr_err("Failed to open %s\n", d->data.path);
- return PTR_ERR(d->session);
+ return (int)PTR_ERR(d->session);
}

has_br_stack = perf_header__has_feat(&d->session->header,
@@ -1179,7 +1179,7 @@ static int __cmd_diff(void)
data__for_each_file(i, d) {
d->session = perf_session__new(&d->data, &pdiff.tool);
if (IS_ERR(d->session)) {
- ret = PTR_ERR(d->session);
+ ret = (int)PTR_ERR(d->session);
pr_err("Failed to open %s\n", d->data.path);
goto out_delete;
}
@@ -1492,10 +1492,10 @@ static int print_cycles_spark(char *bf, int size, unsigned long *svals, u64 n)

if (n > NUM_SPARKS)
n = NUM_SPARKS;
- if (all_zero(svals, n))
+ if (all_zero(svals, (int)n))
return 0;

- printed = print_spark(bf, size, svals, n);
+ printed = print_spark(bf, size, svals, (int)n);
printed += scnprintf(bf + printed, size - printed, " ");
return printed;
}
--
2.49.0.504.g3bcea36a83-goog