diff options
-rw-r--r-- | tools/perf/util/probe-event.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c index 65be284823d5..3010abc071ff 100644 --- a/tools/perf/util/probe-event.c +++ b/tools/perf/util/probe-event.c | |||
@@ -441,19 +441,22 @@ static char *debuginfo_cache_path; | |||
441 | 441 | ||
442 | static struct debuginfo *debuginfo_cache__open(const char *module, bool silent) | 442 | static struct debuginfo *debuginfo_cache__open(const char *module, bool silent) |
443 | { | 443 | { |
444 | if ((debuginfo_cache_path && !strcmp(debuginfo_cache_path, module)) || | 444 | const char *path = module; |
445 | (!debuginfo_cache_path && !module && debuginfo_cache)) | 445 | |
446 | /* If the module is NULL, it should be the kernel. */ | ||
447 | if (!module) | ||
448 | path = "kernel"; | ||
449 | |||
450 | if (debuginfo_cache_path && !strcmp(debuginfo_cache_path, path)) | ||
446 | goto out; | 451 | goto out; |
447 | 452 | ||
448 | /* Copy module path */ | 453 | /* Copy module path */ |
449 | free(debuginfo_cache_path); | 454 | free(debuginfo_cache_path); |
450 | if (module) { | 455 | debuginfo_cache_path = strdup(path); |
451 | debuginfo_cache_path = strdup(module); | 456 | if (!debuginfo_cache_path) { |
452 | if (!debuginfo_cache_path) { | 457 | debuginfo__delete(debuginfo_cache); |
453 | debuginfo__delete(debuginfo_cache); | 458 | debuginfo_cache = NULL; |
454 | debuginfo_cache = NULL; | 459 | goto out; |
455 | goto out; | ||
456 | } | ||
457 | } | 460 | } |
458 | 461 | ||
459 | debuginfo_cache = open_debuginfo(module, silent); | 462 | debuginfo_cache = open_debuginfo(module, silent); |