]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
timens: Add a __free() wrapper for put_time_ns()
authorThomas Weißschuh <thomas.weissschuh@linutronix.de>
Mon, 30 Mar 2026 07:07:55 +0000 (09:07 +0200)
committerThomas Gleixner <tglx@kernel.org>
Wed, 1 Apr 2026 15:13:35 +0000 (17:13 +0200)
The wrapper will be used to simplify cleanups of 'struct time_namespace'.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@kernel.org>
Link: https://patch.msgid.link/20260330-timens-cleanup-v1-1-936e91c9dd30@linutronix.de
include/linux/time_namespace.h

index c1de21a27c340c91cbc09af001052960c5064ec4..58bd9728df5838aa84684f03d3d5da05477e3142 100644 (file)
@@ -8,6 +8,7 @@
 #include <linux/ns_common.h>
 #include <linux/err.h>
 #include <linux/time64.h>
+#include <linux/cleanup.h>
 
 struct user_namespace;
 extern struct user_namespace init_user_ns;
@@ -171,4 +172,6 @@ static inline struct page *find_timens_vvar_page(struct vm_area_struct *vma)
 }
 #endif /* CONFIG_TIME_NS_VDSO */
 
+DEFINE_FREE(time_ns, struct time_namespace *, if (_T) put_time_ns(_T))
+
 #endif /* _LINUX_TIMENS_H */