perf pmu: Simplify an asprintf error message

Use ifs rather than ?: to avoid a large compound statement.

Signed-off-by: Ian Rogers <irogers@google.com>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Link: https://lore.kernel.org/r/20241002032016.333748-2-irogers@google.com
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
This commit is contained in:
Ian Rogers 2024-10-01 20:20:04 -07:00 committed by Namhyung Kim
parent c7c1bb78f3
commit c051220d38

View File

@ -1466,13 +1466,12 @@ static int pmu_config_term(const struct perf_pmu *pmu,
if (err) {
char *err_str;
parse_events_error__handle(err, term->err_val,
asprintf(&err_str,
"value too big for format (%s), maximum is %llu",
format->name, (unsigned long long)max_val) < 0
? strdup("value too big for format")
: err_str,
NULL);
if (asprintf(&err_str,
"value too big for format (%s), maximum is %llu",
format->name, (unsigned long long)max_val) < 0) {
err_str = strdup("value too big for format");
}
parse_events_error__handle(err, term->err_val, err_str, /*help=*/NULL);
return -EINVAL;
}
/*