> -----Original Message----- > From: Christoph Hellwig [mailto:hch@xxxxxxxxxxxxx] > Sent: 21 April 2022 07:49 > To: Shameerali Kolothum Thodi <shameerali.kolothum.thodi@xxxxxxxxxx> > Cc: linux-arm-kernel@xxxxxxxxxxxxxxxxxxx; linux-acpi@xxxxxxxxxxxxxxx; > iommu@xxxxxxxxxxxxxxxxxxxxxxxxxx; Linuxarm <linuxarm@xxxxxxxxxx>; > lorenzo.pieralisi@xxxxxxx; joro@xxxxxxxxxx; robin.murphy@xxxxxxx; > will@xxxxxxxxxx; wanghuiqiang <wanghuiqiang@xxxxxxxxxx>; Guohanjun > (Hanjun Guo) <guohanjun@xxxxxxxxxx>; steven.price@xxxxxxx; > Sami.Mujawar@xxxxxxx; jon@xxxxxxxxxxxxx; eric.auger@xxxxxxxxxx; > laurentiu.tudor@xxxxxxx; hch@xxxxxxxxxxxxx > Subject: Re: [PATCH v10 4/9] ACPI/IORT: Add support to retrieve IORT RMR > reserved regions > [...] > > void generic_iommu_put_resv_regions(struct device *dev, struct list_head > *list) > > { > > struct iommu_resv_region *entry, *next; > > > > - list_for_each_entry_safe(entry, next, list, list) > > + list_for_each_entry_safe(entry, next, list, list) { > > + if (entry->resv_region_free_fw_data) > > + entry->resv_region_free_fw_data(dev, entry); > > kfree(entry); > > I'd move the kfree to the free callback if present. This would also > allow to hide the union from the common code entirely and use a > container structure like: > > struct iommu_iort_rmr_data { > struct iommu_resv_region rr; > > /* Stream IDs associated with IORT RMR entry */ > const u32 *sids; > u32 num_sids; > }; Ok. I will respin soon with the above changes. Thanks, Shameer