> From: Lu Baolu <baolu.lu@xxxxxxxxxxxxxxx> > Sent: Thursday, September 14, 2023 4:57 PM > > + > +/* Caller must hold a reference of the fault parameter. */ > +static void iopf_put_dev_fault_param(struct iommu_fault_param > *fault_param) > +{ > + struct device *dev = fault_param->dev; > + struct dev_iommu *param = dev->iommu; > + > + mutex_lock(¶m->lock); > + if (WARN_ON(fault_param->users <= 0 || > + fault_param != param->fault_param)) { > + mutex_unlock(¶m->lock); > + return; > + } > + > + if (--fault_param->users == 0) { > + param->fault_param = NULL; > + kfree(fault_param); > + put_device(dev); > + } this could be a helper to be shared with iopf_queue_remove_device(). Reviewed-by: Kevin Tian <kevin.tian@xxxxxxxxx>