Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

cleanup: fix scoped_class()

This is a class, not a guard so why on earth is it checking for guard
pointers or conditional lock acquisition? None of it makes any sense at
all.

I'm not sure what happened back then. Maybe I had a brief psychedelic
period that I completely forgot about and spaced out into a zone where
that initial macro implementation made any sense at all.

Link: https://patch.msgid.link/20251103-work-creds-init_cred-v1-1-cb3ec8711a6a@kernel.org
Fixes: 5c21c5f22d07 ("cleanup: add a scoped version of CLASS()")
Reviewed-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Christian Brauner <brauner@kernel.org>

+8 -7
+8 -7
include/linux/cleanup.h
··· 290 290 class_##_name##_t var __cleanup(class_##_name##_destructor) = \ 291 291 class_##_name##_constructor 292 292 293 - #define scoped_class(_name, var, args) \ 294 - for (CLASS(_name, var)(args); \ 295 - __guard_ptr(_name)(&var) || !__is_cond_ptr(_name); \ 296 - ({ goto _label; })) \ 297 - if (0) { \ 298 - _label: \ 299 - break; \ 293 + #define __scoped_class(_name, var, _label, args...) \ 294 + for (CLASS(_name, var)(args); ; ({ goto _label; })) \ 295 + if (0) { \ 296 + _label: \ 297 + break; \ 300 298 } else 299 + 300 + #define scoped_class(_name, var, args...) \ 301 + __scoped_class(_name, var, __UNIQUE_ID(label), args) 301 302 302 303 /* 303 304 * DEFINE_GUARD(name, type, lock, unlock):