summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/perf/util/parse-regs-options.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/tools/perf/util/parse-regs-options.c b/tools/perf/util/parse-regs-options.c
index 8dd35f50f644..b44b47d9059f 100644
--- a/tools/perf/util/parse-regs-options.c
+++ b/tools/perf/util/parse-regs-options.c
@@ -66,12 +66,14 @@ __parse_regs(const struct option *opt, const char *str, int unset, bool intr)
if (*mode)
return -1;
- /* str may be NULL in case no arg is passed to -I */
- if (!str)
- return -1;
-
mask = intr ? arch__intr_reg_mask() : arch__user_reg_mask();
+ /* str may be NULL in case no arg is passed to -I */
+ if (!str) {
+ *mode = mask;
+ return 0;
+ }
+
/* because str is read-only */
s = os = strdup(str);
if (!s)
@@ -104,9 +106,6 @@ __parse_regs(const struct option *opt, const char *str, int unset, bool intr)
}
ret = 0;
- /* default to all possible regs */
- if (*mode == 0)
- *mode = mask;
error:
free(os);
return ret;