On 2022/7/22 13:09, Ming Lei wrote: > __ublk_destroy_dev() is called for handling error in ublk_add_dev(), > but either tagset isn't allocated or mutex isn't initialized. > > So fix the issue by letting ublk_add_dev cleanup its own allocation, > and simply call kfree(ub) outside of ublk_add_dev which is named > as ublk_add_tagset(), meantime ublk_add_chdev() is moved out too. > > Now the error handling in ublk_ctrl_add_dev() becomes more readable. > > Signed-off-by: Ming Lei <ming.lei@xxxxxxxxxx> > --- Reviewed-by: ZiyangZhang <ZiyangZhang@xxxxxxxxxxxxxxxxx>