mirror of
https://github.com/tiagovignatti/intel-gpu-tools.git
synced 2025-06-11 01:46:14 +00:00
lib: make igt_debugfs_open infallible
(Almost) no one cared anyway. Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
This commit is contained in:
parent
096bb851f6
commit
803d07b2ff
@ -37,7 +37,7 @@
|
|||||||
/*
|
/*
|
||||||
* General debugfs helpers
|
* General debugfs helpers
|
||||||
*/
|
*/
|
||||||
int igt_debugfs_init(igt_debugfs_t *debugfs)
|
void igt_debugfs_init(igt_debugfs_t *debugfs)
|
||||||
{
|
{
|
||||||
const char *path = "/sys/kernel/debug";
|
const char *path = "/sys/kernel/debug";
|
||||||
struct stat st;
|
struct stat st;
|
||||||
@ -51,11 +51,9 @@ int igt_debugfs_init(igt_debugfs_t *debugfs)
|
|||||||
if (stat("/sys/kernel/debug/dri", &st) == 0)
|
if (stat("/sys/kernel/debug/dri", &st) == 0)
|
||||||
goto find_minor;
|
goto find_minor;
|
||||||
|
|
||||||
if (stat("/sys/kernel/debug", &st))
|
igt_assert(stat("/sys/kernel/debug", &st) == 0);
|
||||||
return errno;
|
|
||||||
|
|
||||||
if (mount("debug", "/sys/kernel/debug", "debugfs", 0, 0))
|
igt_assert(mount("debug", "/sys/kernel/debug", "debugfs", 0, 0) == 0);
|
||||||
return errno;
|
|
||||||
|
|
||||||
find_minor:
|
find_minor:
|
||||||
strcpy(debugfs->root, path);
|
strcpy(debugfs->root, path);
|
||||||
@ -64,12 +62,13 @@ find_minor:
|
|||||||
sprintf(debugfs->dri_path + len, "/i915_error_state");
|
sprintf(debugfs->dri_path + len, "/i915_error_state");
|
||||||
if (stat(debugfs->dri_path, &st) == 0) {
|
if (stat(debugfs->dri_path, &st) == 0) {
|
||||||
debugfs->dri_path[len] = '\0';
|
debugfs->dri_path[len] = '\0';
|
||||||
return 0;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
debugfs->dri_path[0] = '\0';
|
debugfs->dri_path[0] = '\0';
|
||||||
return ENOENT;
|
|
||||||
|
igt_fail(4);
|
||||||
}
|
}
|
||||||
|
|
||||||
int igt_debugfs_open(igt_debugfs_t *debugfs, const char *filename, int mode)
|
int igt_debugfs_open(igt_debugfs_t *debugfs, const char *filename, int mode)
|
||||||
|
@ -36,7 +36,7 @@ typedef struct {
|
|||||||
char dri_path[128];
|
char dri_path[128];
|
||||||
} igt_debugfs_t;
|
} igt_debugfs_t;
|
||||||
|
|
||||||
int igt_debugfs_init(igt_debugfs_t *debugfs);
|
void igt_debugfs_init(igt_debugfs_t *debugfs);
|
||||||
int igt_debugfs_open(igt_debugfs_t *debugfs, const char *filename, int mode);
|
int igt_debugfs_open(igt_debugfs_t *debugfs, const char *filename, int mode);
|
||||||
FILE *igt_debugfs_fopen(igt_debugfs_t *debugfs, const char *filename,
|
FILE *igt_debugfs_fopen(igt_debugfs_t *debugfs, const char *filename,
|
||||||
const char *mode);
|
const char *mode);
|
||||||
|
@ -1041,7 +1041,7 @@ igt_main
|
|||||||
"Kernel is too old, or contexts not supported: %s\n",
|
"Kernel is too old, or contexts not supported: %s\n",
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
|
|
||||||
assert(igt_debugfs_init(&dfs) == 0);
|
igt_debugfs_init(&dfs);
|
||||||
}
|
}
|
||||||
|
|
||||||
igt_subtest("params")
|
igt_subtest("params")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user