Re: [PATCH v6 07/10] iommufd: Add a nested HW pagetable object

From: Jason Gunthorpe
Date: Tue Oct 24 2023 - 13:38:08 EST


On Tue, Oct 24, 2023 at 08:06:06AM -0700, Yi Liu wrote:
> static inline void iommufd_hw_pagetable_put(struct iommufd_ctx *ictx,
> struct iommufd_hw_pagetable *hwpt)
> {
> - struct iommufd_hwpt_paging *hwpt_paging = to_hwpt_paging(hwpt);
> + if (WARN_ON(hwpt->obj.type != IOMMUFD_OBJ_HWPT_PAGING &&
> + hwpt->obj.type != IOMMUFD_OBJ_HWPT_NESTED))
> + return;

This is redundant, we have a C type, no need to check the type field
like this

Jason