From: Lu Baolu <baolu.lu@xxxxxxxxxxxxxxx>
Sent: Tuesday, July 11, 2023 9:07 AM
@@ -299,7 +299,15 @@ static int dev_iommu_get(struct device *dev)
return -ENOMEM;
mutex_init(¶m->lock);
+ param->fault_param = kzalloc(sizeof(*param->fault_param),
GFP_KERNEL);
+ if (!param->fault_param) {
+ kfree(param);
+ return -ENOMEM;
+ }
+ mutex_init(¶m->fault_param->lock);
+ INIT_LIST_HEAD(¶m->fault_param->faults);
dev->iommu = param;
+
return 0;
}
Upon above changes is it slightly cleaner to call it dev_iommu_init()
to better pair with dev_iommu_free()?