drivers/accel/amdxdna/amdxdna_pci_drv.c:49:34: sparse: sparse: incorrect type in argument 1 (different address spaces)
kernel test robot
build bottree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master head: 8155b4ef3466f0e289e8fcc9e6e62f3f4dceeac2 commit: be462c97b7dfd24999babe39cce3de224ebe1f80 [478/5236] accel/amdxdna: Add hardware context config: x86_64-randconfig-122-20241231 (https://download.01.org/0day-ci/archive/20241231/[email protected]/config) compiler: gcc-12 (Debian 12.2.0-14) 12.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241231/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
sparse warnings: (new ones prefixed by >>)
>> drivers/accel/amdxdna/amdxdna_pci_drv.c:49:34: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected struct pid *pid @@ got struct pid [noderef] __rcu *pid @@
drivers/accel/amdxdna/amdxdna_pci_drv.c:49:34: sparse: expected struct pid *pid
drivers/accel/amdxdna/amdxdna_pci_drv.c:49:34: sparse: got struct pid [noderef] __rcu *pid
vim +49 drivers/accel/amdxdna/amdxdna_pci_drv.c
38
39 static int amdxdna_drm_open(struct drm_device *ddev, struct drm_file *filp)
40 {
41 struct amdxdna_dev *xdna = to_xdna_dev(ddev);
42 struct amdxdna_client *client;
43 int ret;
44
45 client = kzalloc(sizeof(*client), GFP_KERNEL);
46 if (!client)
47 return -ENOMEM;
48
> 49 client->pid = pid_nr(filp->pid);
50 client->xdna = xdna;
51
52 client->sva = iommu_sva_bind_device(xdna->ddev.dev, current->mm);
53 if (IS_ERR(client->sva)) {
54 ret = PTR_ERR(client->sva);
55 XDNA_ERR(xdna, "SVA bind device failed, ret %d", ret);
56 goto failed;
57 }
58 client->pasid = iommu_sva_get_pasid(client->sva);
59 if (client->pasid == IOMMU_PASID_INVALID) {
60 XDNA_ERR(xdna, "SVA get pasid failed");
61 ret = -ENODEV;
62 goto unbind_sva;
63 }
64 mutex_init(&client->hwctx_lock);
65 idr_init_base(&client->hwctx_idr, AMDXDNA_INVALID_CTX_HANDLE + 1);
66
67 mutex_lock(&xdna->dev_lock);
68 list_add_tail(&client->node, &xdna->client_list);
69 mutex_unlock(&xdna->dev_lock);
70
71 filp->driver_priv = client;
72 client->filp = filp;
73
74 XDNA_DBG(xdna, "pid %d opened", client->pid);
75 return 0;
76
77 unbind_sva:
78 iommu_sva_unbind_device(client->sva);
79 failed:
80 kfree(client);
81
82 return ret;
83 }
84 Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki