On Tue, 02 Jun 2026 20:45:09 +0800, Rui Qi [off-list ref] wrote:
quoted hunk ↗ jump to hunk
diff --git a/tools/testing/selftests/livepatch/test_modules/test_klp_syscall.c b/tools/testing/selftests/livepatch/test_modules/test_klp_syscall.c
index 0630ffd9d9a1..d631acae48b9 100644
--- a/tools/testing/selftests/livepatch/test_modules/test_klp_syscall.c
+++ b/tools/testing/selftests/livepatch/test_modules/test_klp_syscall.c
@@ -109,7 +109,12 @@ static int livepatch_init(void)
*/
npids = npids_pending;
- return klp_enable_patch(&patch);
+ ret = klp_enable_patch(&patch);
+ if (ret) {
+ sysfs_remove_file(klp_kobj, &klp_attr.attr);
+ kobject_put(klp_kobj);
+ }
+ return ret;
Is sysfs_remove_file() needed? I think that kobject_put() should remove
it automatically since the object is bound to sysfs.
--
Miroslav