[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251118155122.59dde92f@gandalf.local.home>
Date: Tue, 18 Nov 2025 15:51:22 -0500
From: Steven Rostedt <rostedt@...dmis.org>
To: James Bottomley <James.Bottomley@...senPartnership.com>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>, Bart Van Assche
<bvanassche@....org>, ksummit@...ts.linux.dev, Dan Williams
<dan.j.williams@...el.com>, linux-kernel <linux-kernel@...r.kernel.org>,
Dan Carpenter <dan.carpenter@...aro.org>
Subject: Re: Clarifying confusion of our variable placement rules caused by
cleanup.h
On Tue, 18 Nov 2025 15:21:10 -0500
James Bottomley <James.Bottomley@...senPartnership.com> wrote:
> There is one last case that hasn't been discussed, which is where you
> deliberately introduce an extra scope block for the free and
> allocation, so in your example above it would look like
>
> if (ret < )
> return -ERROR
>
> [ several more error exits ]
>
> {
> struct foo *var __free(kfree) = kmalloc(...)
>
> [...]
> }
I'm not too big on explicit blocks for just declarations. Especially, in my
case where the var is used until the end:
{
struct foo *var __free(kfree) = kmalloc(...)
[...]
return func(..., var);
}
It seems a bit strange to have the final return of a function from within
an explicit scope block. Especially since the beginning is just for error
conditions, and the meat of the function is now in that explicit block.
-- Steve
Powered by blists - more mailing lists