[luxis1999-iommufd:iommufd-v5.17-rc4 28/56] drivers/iommu/iommufd/selftest.c:198:31: warning: comparison of distinct pointer types lacks a cast

From: kernel test robot
Date: Tue Feb 15 2022 - 09:07:59 EST


tree: https://github.com/luxis1999/iommufd iommufd-v5.17-rc4
head: 94542ac92f6f23784d73c13b39dc95cc4012181c
commit: 047031aaa50c5daed9c24fa0701f7016d4ff6934 [28/56] iommufd: Add a selftest
config: alpha-allyesconfig (https://download.01.org/0day-ci/archive/20220215/202202152214.sfZjnb0v-lkp@xxxxxxxxx/config)
compiler: alpha-linux-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/luxis1999/iommufd/commit/047031aaa50c5daed9c24fa0701f7016d4ff6934
git remote add luxis1999-iommufd https://github.com/luxis1999/iommufd
git fetch --no-tags luxis1999-iommufd iommufd-v5.17-rc4
git checkout 047031aaa50c5daed9c24fa0701f7016d4ff6934
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=alpha SHELL=/bin/bash drivers/iommu/iommufd/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All warnings (new ones prefixed by >>):

drivers/iommu/iommufd/selftest.c: In function 'mock_domain_alloc':
drivers/iommu/iommufd/selftest.c:69:26: error: assignment to 'const struct iommu_domain_ops *' from incompatible pointer type 'const struct iommu_ops *' [-Werror=incompatible-pointer-types]
69 | mock->domain.ops = &domain_mock_ops;
| ^
drivers/iommu/iommufd/selftest.c: At top level:
drivers/iommu/iommufd/selftest.c:180:10: error: 'const struct iommu_ops' has no member named 'domain_free'
180 | .domain_free = mock_domain_free,
| ^~~~~~~~~~~
drivers/iommu/iommufd/selftest.c:180:24: error: initialization of 'struct iommu_device * (*)(struct device *)' from incompatible pointer type 'void (*)(struct iommu_domain *)' [-Werror=incompatible-pointer-types]
180 | .domain_free = mock_domain_free,
| ^~~~~~~~~~~~~~~~
drivers/iommu/iommufd/selftest.c:180:24: note: (near initialization for 'domain_mock_ops.probe_device')
drivers/iommu/iommufd/selftest.c:181:10: error: 'const struct iommu_ops' has no member named 'map_pages'
181 | .map_pages = mock_domain_map_pages,
| ^~~~~~~~~
drivers/iommu/iommufd/selftest.c:181:22: error: initialization of 'void (*)(struct device *)' from incompatible pointer type 'int (*)(struct iommu_domain *, long unsigned int, phys_addr_t, size_t, size_t, int, gfp_t, size_t *)' {aka 'int (*)(struct iommu_domain *, long unsigned int, long long unsigned int, long unsigned int, long unsigned int, int, unsigned int, long unsigned int *)'} [-Werror=incompatible-pointer-types]
181 | .map_pages = mock_domain_map_pages,
| ^~~~~~~~~~~~~~~~~~~~~
drivers/iommu/iommufd/selftest.c:181:22: note: (near initialization for 'domain_mock_ops.release_device')
drivers/iommu/iommufd/selftest.c:182:10: error: 'const struct iommu_ops' has no member named 'unmap_pages'
182 | .unmap_pages = mock_domain_unmap_pages,
| ^~~~~~~~~~~
drivers/iommu/iommufd/selftest.c:182:24: error: initialization of 'void (*)(struct device *)' from incompatible pointer type 'size_t (*)(struct iommu_domain *, long unsigned int, size_t, size_t, struct iommu_iotlb_gather *)' {aka 'long unsigned int (*)(struct iommu_domain *, long unsigned int, long unsigned int, long unsigned int, struct iommu_iotlb_gather *)'} [-Werror=incompatible-pointer-types]
182 | .unmap_pages = mock_domain_unmap_pages,
| ^~~~~~~~~~~~~~~~~~~~~~~
drivers/iommu/iommufd/selftest.c:182:24: note: (near initialization for 'domain_mock_ops.probe_finalize')
drivers/iommu/iommufd/selftest.c:183:10: error: 'const struct iommu_ops' has no member named 'iova_to_phys'
183 | .iova_to_phys = mock_domain_iova_to_phys,
| ^~~~~~~~~~~~
drivers/iommu/iommufd/selftest.c:183:25: error: initialization of 'struct iommu_group * (*)(struct device *)' from incompatible pointer type 'phys_addr_t (*)(struct iommu_domain *, dma_addr_t)' {aka 'long long unsigned int (*)(struct iommu_domain *, long long unsigned int)'} [-Werror=incompatible-pointer-types]
183 | .iova_to_phys = mock_domain_iova_to_phys,
| ^~~~~~~~~~~~~~~~~~~~~~~~
drivers/iommu/iommufd/selftest.c:183:25: note: (near initialization for 'domain_mock_ops.device_group')
drivers/iommu/iommufd/selftest.c: In function 'get_md_pagetable':
>> drivers/iommu/iommufd/selftest.c:198:31: warning: comparison of distinct pointer types lacks a cast
198 | if (hwpt->domain->ops != &domain_mock_ops) {
| ^~
cc1: some warnings being treated as errors


vim +198 drivers/iommu/iommufd/selftest.c

185
186 static inline struct iommufd_hw_pagetable *
187 get_md_pagetable(struct iommufd_ucmd *ucmd, u32 mockpt_id,
188 struct mock_iommu_domain **mock)
189 {
190 struct iommufd_hw_pagetable *hwpt;
191 struct iommufd_object *obj;
192
193 obj = iommufd_get_object(ucmd->ictx, mockpt_id,
194 IOMMUFD_OBJ_HW_PAGETABLE);
195 if (IS_ERR(obj))
196 return ERR_CAST(obj);
197 hwpt = container_of(obj, struct iommufd_hw_pagetable, obj);
> 198 if (hwpt->domain->ops != &domain_mock_ops) {
199 return ERR_PTR(-EINVAL);
200 iommufd_put_object(&hwpt->obj);
201 }
202 *mock = container_of(hwpt->domain, struct mock_iommu_domain, domain);
203 return hwpt;
204 }
205

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx