On 2023/7/11 14:14, Tian, Kevin wrote:
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()?
dev_iommu_init() was introduced in Jason's series. It's not landed yet.
https://lore.kernel.org/linux-iommu/0-v3-328044aa278c+45e49-iommu_probe_jgg@xxxxxxxxxx/
Sure. Should refine this code after above patches are landed.
Best regards,
baolu