On Wed, Feb 09, 2022 at 09:21:17AM +0100, Christoph Hellwig wrote: > Implement the ->free_disk method to free the msb_data structure only once > the last gendisk reference goes away instead of keeping a local refcount. > The approach looks good, just the error handling needs to be careful, such as, once driver data is bound to disk->private_data, the previous error handling code shouldn't touch/free the driver data any more. That said assigning disk->private_data implies driver data ownership transfer after this conversion. Such as, in msb_init_disk(), once blk_cleanup_disk() is done, the code branch of out_release_id shouldn't be run; msb_probe() has the similar issue too. Thanks, Ming