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

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>

authored by

Ian Rogers and committed by
Namhyung Kim
c051220d c7c1bb78

+6 -7
+6 -7
tools/perf/util/pmu.c
··· 1466 1466 if (err) { 1467 1467 char *err_str; 1468 1468 1469 - parse_events_error__handle(err, term->err_val, 1470 - asprintf(&err_str, 1471 - "value too big for format (%s), maximum is %llu", 1472 - format->name, (unsigned long long)max_val) < 0 1473 - ? strdup("value too big for format") 1474 - : err_str, 1475 - NULL); 1469 + if (asprintf(&err_str, 1470 + "value too big for format (%s), maximum is %llu", 1471 + format->name, (unsigned long long)max_val) < 0) { 1472 + err_str = strdup("value too big for format"); 1473 + } 1474 + parse_events_error__handle(err, term->err_val, err_str, /*help=*/NULL); 1476 1475 return -EINVAL; 1477 1476 } 1478 1477 /*