On Tue, Dec 12, 2023 at 12:39:40PM +0300, Dan Carpenter wrote: > > > @@ -2924,6 +2945,7 @@ struct token *external_declaration(struct token *token, struct symbol_list **lis > > > > > > decl->ctype = ctx.ctype; > > > decl->ctype.modifiers |= mod; > > > + decl->cleanup = ctx.cleanup; > > > > Similarly, the attribute should only be applied to automatic variables, > > so this should not be needed/should be detected as an error. > > > > Yeah. There are a couple other "cleanup" lines later in the function > that should be deleted as well, I see. Hm... Something went wrong. When I remove this assignment then the cleanup function isn't saved here: void sched_exec(void) { struct task_struct *p = get_current(); struct migration_arg arg; int dest_cpu; for (class_raw_spinlock_irqsave_t scope __attribute__((__cleanup__(class_raw_spinlock_irqsave_destructor))) = class_raw_spinlock_irqsave_constructor(&p->pi_lock), *done = ((void *)0); class_raw_spinlock_irqsave_lock_ptr(&scope) && !done; done = (void *)1) { dest_cpu = p->sched_class->select_task_rq(p, task_cpu(p), 0x02); if (dest_cpu == debug_smp_processor_id()) return; if (__builtin_expect(!!(!cpu_active(dest_cpu)), 0)) return; arg = (struct migration_arg){ p, dest_cpu }; } stop_one_cpu(task_cpu(p), migration_cpu_stop, &arg); } regards, dan carpenter