On Tue, Mar 16, 2021 at 07:55:11AM +0000, Tian, Kevin wrote: > > +void *vfio_del_group_dev(struct device *dev) > > +{ > > + struct vfio_device *device = dev_get_drvdata(dev); > > + void *device_data = device->device_data; > > + > > + vfio_unregister_group_dev(device); > > dev_set_drvdata(dev, NULL); > > Move to vfio_unregister_group_dev? In the cover letter you mentioned > that drvdata is managed by the driver but removed from the core. "removed from the core" means the core code doesn't touch drvdata at all. > Looks it's also the rule obeyed by the following patches. The dev_set_drvdata(NULL) on remove is mostly cargo-cult nonsense. The driver core sets it to null immediately after the remove function returns, so to add another set needs a very strong reason. It is only left here temporarily, the last patch deletes it. Jason