Re: [PATCH v3] cleanup: adjust scoped_guard() macros to avoid potential warning

From: Przemek Kitszel
Date: Wed Oct 23 2024 - 10:58:05 EST


On 10/23/24 16:32, Peter Zijlstra wrote:
On Wed, Oct 23, 2024 at 03:43:22PM +0200, Przemek Kitszel wrote:
On 10/18/24 12:50, Peter Zijlstra wrote:
On Sun, Oct 13, 2024 at 12:01:24PM +0800, kernel test robot wrote:

--- a/include/linux/cleanup.h
+++ b/include/linux/cleanup.h
@@ -323,7 +323,7 @@ static __maybe_unused const bool class_#
*/
#define __scoped_guard(_name, _fail, _label, args...) \
for (CLASS(_name, scope)(args); true; ({ goto _label; })) \
- if (!__guard_ptr(_name)(&scope) && __is_cond_ptr(_name)) { \
+ if (__is_cond_ptr(_name) && !__guard_ptr(_name)(&scope)) { \

but this will purge the attempt to call __guard_ptr(), and thus newer
lock ;) good that there is at least some comment above

No, __guard_ptr() will only return a pointer, it has no action. The lock
callback is in CLASS(_name, scope)(args).

Ach, true! Thanks again for taking a look at my series!