Re: [PATCH 2/3] block: untangle request_queue refcounting from sysfs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Nov 07, 2022 at 11:57:36AM -0800, Eric Biggers wrote:
> On Sat, Nov 05, 2022 at 09:08:14AM +0100, Christoph Hellwig wrote:
> > @@ -811,7 +772,8 @@ int blk_register_queue(struct gendisk *disk)
> >  
> >  	mutex_lock(&q->sysfs_dir_lock);
> >  
> > -	ret = kobject_add(&q->kobj, &disk_to_dev(disk)->kobj, "queue");
> > +	kobject_init(&disk->queue_kobj, &blk_queue_ktype);
> > +	ret = kobject_add(&disk->queue_kobj, &disk_to_dev(disk)->kobj, "queue");
> 
> Use kobject_init_and_add()?

I never found a good reason to use that over the two calls.  It doesn't
clear up what is done, and doesn't save code size either.

> Also, kobject_put() needs to be called on error.

Indeed.  Also for the later error cases.



[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux