When first calling perf_config(), config set is initialized but 'config' sub-command need to reset config set because of '--user' or '--system' options.
The options of 'config' sub-command is to select a particular config file location so the config set should be reinitialized collecting configs from selected exclusive config file. Cc: Namhyung Kim <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Masami Hiramatsu <[email protected]> Cc: Alexander Shishkin <[email protected]> Signed-off-by: Taeung Song <[email protected]> --- tools/perf/builtin-config.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/tools/perf/builtin-config.c b/tools/perf/builtin-config.c index 4a61411..dc5b52f 100644 --- a/tools/perf/builtin-config.c +++ b/tools/perf/builtin-config.c @@ -47,7 +47,6 @@ static int show_config(const char *key, const char *value, int cmd_config(int argc, const char **argv, const char *prefix __maybe_unused) { int ret = 0; - struct perf_config_set *set; char *user_config = mkpath("%s/.perfconfig", getenv("HOME")); argc = parse_options(argc, argv, config_options, config_usage, @@ -65,11 +64,11 @@ int cmd_config(int argc, const char **argv, const char *prefix __maybe_unused) else if (use_user_config) config_exclusive_filename = user_config; - set = perf_config_set__new(); - if (!set) { - ret = -1; - goto out_err; - } + /* + * Reset config set at only 'config' sub-command + * because of options config file location. + */ + perf_config_set__delete(); switch (actions) { case ACTION_LIST: @@ -92,6 +91,5 @@ int cmd_config(int argc, const char **argv, const char *prefix __maybe_unused) } perf_config_set__delete(); -out_err: return ret; } -- 2.5.0

