[igt-dev] [PATCH i-g-t 3/4] lib/kselftests: return non-zero on open(kmsg) failure

Tales Aparecida tales.aparecida at gmail.com
Wed Aug 3 05:26:53 UTC 2022


Previously igt_kselftest_begin() always returned 0.
Return non-zero if failed to open kmsg, instead.

Signed-off-by: Tales Aparecida <tales.aparecida at gmail.com>
---
 lib/igt_kmod.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lib/igt_kmod.c b/lib/igt_kmod.c
index bde0461a..63636243 100644
--- a/lib/igt_kmod.c
+++ b/lib/igt_kmod.c
@@ -933,6 +933,8 @@ int igt_kselftest_begin(struct igt_kselftest *tst)
 	igt_require(err == 0 || err == -ENOENT);
 
 	tst->kmsg = open("/dev/kmsg", O_RDONLY | O_NONBLOCK);
+	if (tst->kmsg < 0)
+		return 1;
 
 	return 0;
 }
-- 
2.37.0



More information about the igt-dev mailing list