Re: [PATCH RFC v2 08/18] fs: add dedicated block device open helpers for filesystems

From: Christoph Hellwig

Date: Wed Jun 24 2026 - 10:12:14 EST


On Mon, Jun 22, 2026 at 06:28:50PM +0200, Jan Kara wrote:
> > +static int fs_bdev_register(struct file *bdev_file, struct super_block *sb)
> > +{
> > + struct super_dev *sb_dev __free(kfree) = NULL;
>
> Frankly I find the use of __free on sb_dev more confusing than helping in
> this function. If you didn't use it, you could remove the somewhat
> confusing retain_and_null_ptr() calls below, remove this initialization and
> just put one kfree() into the error handling branch when super_dev_insert()
> fails...

It is. __free is really annoying for anything but trivial local
scope only variables.