On Mon, Apr 11, 2022 at 01:16:23AM +0800, Shiyang Ruan wrote: > diff --git a/drivers/nvdimm/pmem.c b/drivers/nvdimm/pmem.c > index bd502957cfdf..72d9e69aea98 100644 > --- a/drivers/nvdimm/pmem.c > +++ b/drivers/nvdimm/pmem.c > @@ -359,7 +359,6 @@ static void pmem_release_disk(void *__pmem) > struct pmem_device *pmem = __pmem; > > dax_remove_host(pmem->disk); > - kill_dax(pmem->dax_dev); > put_dax(pmem->dax_dev); > del_gendisk(pmem->disk); > > @@ -597,6 +596,8 @@ static void nd_pmem_remove(struct device *dev) > pmem->bb_state = NULL; > } > nvdimm_flush(to_nd_region(dev->parent), NULL); > + > + kill_dax(pmem->dax_dev); I think the put_dax will have to move as well. This part should probably also be a separate, well-documented cleanup patch.