tree:
https://android.googlesource.com/kernel/common android-4.19
head: 45a6d3f5180d2d65d6d83fc9ecfa93fd2a332a67
commit: 748a437c5c0179283ae1814b612f9e1a744f3839 [12/14] UPSTREAM: virtio-pmem: Add virtio
pmem driver
config: x86_64-randconfig-s021-20201231 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce:
# apt-get install sparse
# sparse version: v0.6.3-184-g1b896707-dirty
git remote add android-common
https://android.googlesource.com/kernel/common
git fetch --no-tags android-common android-4.19
git checkout 748a437c5c0179283ae1814b612f9e1a744f3839
# save the attached .config to linux build tree
make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=x86_64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
"sparse warnings: (new ones prefixed by >>)"
> drivers/nvdimm/nd_virtio.c:56:28: sparse: sparse: incorrect type
in assignment (different base types) @@ expected unsigned int [usertype] type @@
got restricted __virtio32 @@
drivers/nvdimm/nd_virtio.c:56:28: sparse:
expected unsigned int [usertype] type
drivers/nvdimm/nd_virtio.c:56:28: sparse: got restricted __virtio32
> drivers/nvdimm/nd_virtio.c:93:59: sparse: sparse: incorrect type
in argument 2 (different base types) @@ expected restricted __virtio32 [usertype] val
@@ got unsigned int [usertype] ret @@
drivers/nvdimm/nd_virtio.c:93:59:
sparse: expected restricted __virtio32 [usertype] val
drivers/nvdimm/nd_virtio.c:93:59: sparse: got unsigned int [usertype] ret
vim +56 drivers/nvdimm/nd_virtio.c
36
37 /* The request submission function */
38 static int virtio_pmem_flush(struct nd_region *nd_region)
39 {
40 struct virtio_device *vdev = nd_region->provider_data;
41 struct virtio_pmem *vpmem = vdev->priv;
42 struct virtio_pmem_request *req_data;
43 struct scatterlist *sgs[2], sg, ret;
44 unsigned long flags;
45 int err, err1;
46
47 might_sleep();
48 req_data = kmalloc(sizeof(*req_data), GFP_KERNEL);
49 if (!req_data)
50 return -ENOMEM;
51
52 req_data->done = false;
53 init_waitqueue_head(&req_data->host_acked);
54 init_waitqueue_head(&req_data->wq_buf);
55 INIT_LIST_HEAD(&req_data->list);
56 req_data->req.type = cpu_to_virtio32(vdev,
VIRTIO_PMEM_REQ_TYPE_FLUSH);
57 sg_init_one(&sg, &req_data->req,
sizeof(req_data->req));
58 sgs[0] = &sg;
59 sg_init_one(&ret, &req_data->resp.ret, sizeof(req_data->resp));
60 sgs[1] = &ret;
61
62 spin_lock_irqsave(&vpmem->pmem_lock, flags);
63 /*
64 * If virtqueue_add_sgs returns -ENOSPC then req_vq virtual
65 * queue does not have free descriptor. We add the request
66 * to req_list and wait for host_ack to wake us up when free
67 * slots are available.
68 */
69 while ((err = virtqueue_add_sgs(vpmem->req_vq, sgs, 1, 1, req_data,
70 GFP_ATOMIC)) == -ENOSPC) {
71
72 dev_info(&vdev->dev, "failed to send command to virtio pmem device,
no free slots in the virtqueue\n");
73 req_data->wq_buf_avail = false;
74 list_add_tail(&req_data->list, &vpmem->req_list);
75 spin_unlock_irqrestore(&vpmem->pmem_lock, flags);
76
77 /* A host response results in "host_ack" getting called */
78 wait_event(req_data->wq_buf, req_data->wq_buf_avail);
79 spin_lock_irqsave(&vpmem->pmem_lock, flags);
80 }
81 err1 = virtqueue_kick(vpmem->req_vq);
82 spin_unlock_irqrestore(&vpmem->pmem_lock, flags);
83 /*
84 * virtqueue_add_sgs failed with error different than -ENOSPC, we can't
85 * do anything about that.
86 */
87 if (err || !err1) {
88 dev_info(&vdev->dev, "failed to send command to virtio pmem
device\n");
89 err = -EIO;
90 } else {
91 /* A host repsonse results in "host_ack" getting called */
92 wait_event(req_data->host_acked, req_data->done);
93 err = virtio32_to_cpu(vdev, req_data->resp.ret);
94 }
95
96 kfree(req_data);
97 return err;
98 };
99
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org