On 2022/7/28 08:18, Ming Lei wrote: > On Wed, Jul 27, 2022 at 06:21:32PM +0200, Christoph Hellwig wrote: >> maybe s/avoid/don't/ in the subject? > > OK, will change in V3. > >> >>> - get_device(&ub->cdev_dev); >>> ret = add_disk(disk); >>> if (ret) { >>> put_disk(disk); >>> goto out_unlock; >> >> Maybe just add a put_device here in the error branch to keep >> things simple? > > That is fine. > > Another way is to add 'out_put_disk' error label which can be > reused with previous error handling. +1, adding another error label looks clear and simple.