Skip to content

Commit fed1208

Browse files
suryasaimadhuacmel
authored andcommitted
perf tools: Remove a write-only variable in the debugfs code
debugfs_premounted is written-to only so drop it. This functionality is covered by debugfs_found now. Make it a bool while at it. Signed-off-by: Borislav Petkov <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Steven Rostedt <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent 861e10b commit fed1208

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

tools/perf/util/debugfs.c

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
#include <linux/kernel.h>
66
#include <sys/mount.h>
77

8-
static int debugfs_premounted;
98
char debugfs_mountpoint[PATH_MAX + 1] = "/sys/kernel/debug";
109
char tracing_events_path[PATH_MAX + 1] = "/sys/kernel/debug/tracing/events";
1110

@@ -15,7 +14,7 @@ static const char *debugfs_known_mountpoints[] = {
1514
0,
1615
};
1716

18-
static int debugfs_found;
17+
static bool debugfs_found;
1918

2019
/* find the path to the mounted debugfs */
2120
const char *debugfs_find_mountpoint(void)
@@ -30,7 +29,7 @@ const char *debugfs_find_mountpoint(void)
3029
ptr = debugfs_known_mountpoints;
3130
while (*ptr) {
3231
if (debugfs_valid_mountpoint(*ptr) == 0) {
33-
debugfs_found = 1;
32+
debugfs_found = true;
3433
strcpy(debugfs_mountpoint, *ptr);
3534
return debugfs_mountpoint;
3635
}
@@ -52,7 +51,7 @@ const char *debugfs_find_mountpoint(void)
5251
if (strcmp(type, "debugfs") != 0)
5352
return NULL;
5453

55-
debugfs_found = 1;
54+
debugfs_found = true;
5655

5756
return debugfs_mountpoint;
5857
}
@@ -82,10 +81,8 @@ static void debugfs_set_tracing_events_path(const char *mountpoint)
8281
char *debugfs_mount(const char *mountpoint)
8382
{
8483
/* see if it's already mounted */
85-
if (debugfs_find_mountpoint()) {
86-
debugfs_premounted = 1;
84+
if (debugfs_find_mountpoint())
8785
goto out;
88-
}
8986

9087
/* if not mounted and no argument */
9188
if (mountpoint == NULL) {
@@ -100,7 +97,7 @@ char *debugfs_mount(const char *mountpoint)
10097
return NULL;
10198

10299
/* save the mountpoint */
103-
debugfs_found = 1;
100+
debugfs_found = true;
104101
strncpy(debugfs_mountpoint, mountpoint, sizeof(debugfs_mountpoint));
105102
out:
106103
debugfs_set_tracing_events_path(debugfs_mountpoint);

0 commit comments

Comments
 (0)