linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Anton Yakovlev <anton.yakovlev@opensynergy.com>
Cc: kbuild-all@lists.01.org,
	Linux Memory Management List <linux-mm@kvack.org>,
	"Michael S. Tsirkin" <mst@redhat.com>
Subject: [linux-next:master 9707/11791] sound/virtio/virtio_ctl_msg.c:140:24: sparse: sparse: incorrect type in assignment (different base types)
Date: Fri, 19 Feb 2021 19:39:25 +0800	[thread overview]
Message-ID: <202102191920.WhsLTGaP-lkp@intel.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 9124 bytes --]

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   ff90dfd2579b2c7bc1f0baa0cb99c918c6c1ec64
commit: eec5c215788286bc5461153b28c32cf75433ee9c [9707/11791] ALSA: virtio: handling control messages
config: microblaze-randconfig-s031-20210219 (attached as .config)
compiler: microblaze-linux-gcc (GCC) 9.3.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # apt-get install sparse
        # sparse version: v0.6.3-229-g60c1f270-dirty
        # https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=eec5c215788286bc5461153b28c32cf75433ee9c
        git remote add linux-next https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
        git fetch --no-tags linux-next master
        git checkout eec5c215788286bc5461153b28c32cf75433ee9c
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=microblaze 

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


"sparse warnings: (new ones prefixed by >>)"
>> sound/virtio/virtio_ctl_msg.c:140:24: sparse: sparse: incorrect type in assignment (different base types) @@     expected restricted __le32 [usertype] code @@     got restricted __virtio32 @@
   sound/virtio/virtio_ctl_msg.c:140:24: sparse:     expected restricted __le32 [usertype] code
   sound/virtio/virtio_ctl_msg.c:140:24: sparse:     got restricted __virtio32
   sound/virtio/virtio_ctl_msg.c:275:25: sparse: sparse: incorrect type in assignment (different base types) @@     expected restricted __le32 [usertype] code @@     got restricted __virtio32 @@
   sound/virtio/virtio_ctl_msg.c:275:25: sparse:     expected restricted __le32 [usertype] code
   sound/virtio/virtio_ctl_msg.c:275:25: sparse:     got restricted __virtio32
>> sound/virtio/virtio_ctl_msg.c:276:25: sparse: sparse: incorrect type in assignment (different base types) @@     expected restricted __le32 [usertype] start_id @@     got restricted __virtio32 @@
   sound/virtio/virtio_ctl_msg.c:276:25: sparse:     expected restricted __le32 [usertype] start_id
   sound/virtio/virtio_ctl_msg.c:276:25: sparse:     got restricted __virtio32
>> sound/virtio/virtio_ctl_msg.c:277:22: sparse: sparse: incorrect type in assignment (different base types) @@     expected restricted __le32 [usertype] count @@     got restricted __virtio32 @@
   sound/virtio/virtio_ctl_msg.c:277:22: sparse:     expected restricted __le32 [usertype] count
   sound/virtio/virtio_ctl_msg.c:277:22: sparse:     got restricted __virtio32
>> sound/virtio/virtio_ctl_msg.c:278:21: sparse: sparse: incorrect type in assignment (different base types) @@     expected restricted __le32 [usertype] size @@     got restricted __virtio32 @@
   sound/virtio/virtio_ctl_msg.c:278:21: sparse:     expected restricted __le32 [usertype] size
   sound/virtio/virtio_ctl_msg.c:278:21: sparse:     got restricted __virtio32

vim +140 sound/virtio/virtio_ctl_msg.c

   108	
   109	/**
   110	 * virtsnd_ctl_msg_send() - Send a control message.
   111	 * @snd: VirtIO sound device.
   112	 * @msg: Control message.
   113	 * @out_sgs: Additional sg-list to attach to the request header (may be NULL).
   114	 * @in_sgs: Additional sg-list to attach to the response header (may be NULL).
   115	 * @nowait: Flag indicating whether to wait for completion.
   116	 *
   117	 * Context: Any context. Takes and releases the control queue spinlock.
   118	 *          May sleep if @nowait is false.
   119	 * Return: 0 on success, -errno on failure.
   120	 */
   121	int virtsnd_ctl_msg_send(struct virtio_snd *snd, struct virtio_snd_msg *msg,
   122				 struct scatterlist *out_sgs,
   123				 struct scatterlist *in_sgs, bool nowait)
   124	{
   125		struct virtio_device *vdev = snd->vdev;
   126		struct virtio_snd_queue *queue = virtsnd_control_queue(snd);
   127		unsigned int js = msecs_to_jiffies(msg_timeout_ms);
   128		struct virtio_snd_hdr *request = virtsnd_ctl_msg_request(msg);
   129		struct virtio_snd_hdr *response = virtsnd_ctl_msg_response(msg);
   130		unsigned int nouts = 0;
   131		unsigned int nins = 0;
   132		struct scatterlist *psgs[4];
   133		bool notify = false;
   134		unsigned long flags;
   135		int rc;
   136	
   137		virtsnd_ctl_msg_ref(msg);
   138	
   139		/* Set the default status in case the message was canceled. */
 > 140		response->code = cpu_to_virtio32(vdev, VIRTIO_SND_S_IO_ERR);
   141	
   142		psgs[nouts++] = &msg->sg_request;
   143		if (out_sgs)
   144			psgs[nouts++] = out_sgs;
   145	
   146		psgs[nouts + nins++] = &msg->sg_response;
   147		if (in_sgs)
   148			psgs[nouts + nins++] = in_sgs;
   149	
   150		spin_lock_irqsave(&queue->lock, flags);
   151		rc = virtqueue_add_sgs(queue->vqueue, psgs, nouts, nins, msg,
   152				       GFP_ATOMIC);
   153		if (!rc) {
   154			notify = virtqueue_kick_prepare(queue->vqueue);
   155	
   156			list_add_tail(&msg->list, &snd->ctl_msgs);
   157		}
   158		spin_unlock_irqrestore(&queue->lock, flags);
   159	
   160		if (rc) {
   161			dev_err(&vdev->dev, "failed to send control message (0x%08x)\n",
   162				le32_to_cpu(request->code));
   163	
   164			/*
   165			 * Since in this case virtsnd_ctl_msg_complete() will not be
   166			 * called, it is necessary to decrement the reference count.
   167			 */
   168			virtsnd_ctl_msg_unref(msg);
   169	
   170			goto on_exit;
   171		}
   172	
   173		if (notify)
   174			virtqueue_notify(queue->vqueue);
   175	
   176		if (nowait)
   177			goto on_exit;
   178	
   179		rc = wait_for_completion_interruptible_timeout(&msg->notify, js);
   180		if (rc <= 0) {
   181			if (!rc) {
   182				dev_err(&vdev->dev,
   183					"control message (0x%08x) timeout\n",
   184					le32_to_cpu(request->code));
   185				rc = -ETIMEDOUT;
   186			}
   187	
   188			goto on_exit;
   189		}
   190	
   191		switch (le32_to_cpu(response->code)) {
   192		case VIRTIO_SND_S_OK:
   193			rc = 0;
   194			break;
   195		case VIRTIO_SND_S_NOT_SUPP:
   196			rc = -EOPNOTSUPP;
   197			break;
   198		case VIRTIO_SND_S_IO_ERR:
   199			rc = -EIO;
   200			break;
   201		default:
   202			rc = -EINVAL;
   203			break;
   204		}
   205	
   206	on_exit:
   207		virtsnd_ctl_msg_unref(msg);
   208	
   209		return rc;
   210	}
   211	
   212	/**
   213	 * virtsnd_ctl_msg_complete() - Complete a control message.
   214	 * @msg: Control message.
   215	 *
   216	 * Context: Any context. Expects the control queue spinlock to be held by
   217	 *          caller.
   218	 */
   219	void virtsnd_ctl_msg_complete(struct virtio_snd_msg *msg)
   220	{
   221		list_del(&msg->list);
   222		complete(&msg->notify);
   223	
   224		virtsnd_ctl_msg_unref(msg);
   225	}
   226	
   227	/**
   228	 * virtsnd_ctl_msg_cancel_all() - Cancel all pending control messages.
   229	 * @snd: VirtIO sound device.
   230	 *
   231	 * Context: Any context.
   232	 */
   233	void virtsnd_ctl_msg_cancel_all(struct virtio_snd *snd)
   234	{
   235		struct virtio_snd_queue *queue = virtsnd_control_queue(snd);
   236		unsigned long flags;
   237	
   238		spin_lock_irqsave(&queue->lock, flags);
   239		while (!list_empty(&snd->ctl_msgs)) {
   240			struct virtio_snd_msg *msg =
   241				list_first_entry(&snd->ctl_msgs, struct virtio_snd_msg,
   242						 list);
   243	
   244			virtsnd_ctl_msg_complete(msg);
   245		}
   246		spin_unlock_irqrestore(&queue->lock, flags);
   247	}
   248	
   249	/**
   250	 * virtsnd_ctl_query_info() - Query the item configuration from the device.
   251	 * @snd: VirtIO sound device.
   252	 * @command: Control request code (VIRTIO_SND_R_XXX_INFO).
   253	 * @start_id: Item start identifier.
   254	 * @count: Item count to query.
   255	 * @size: Item information size in bytes.
   256	 * @info: Buffer for storing item information.
   257	 *
   258	 * Context: Any context that permits to sleep.
   259	 * Return: 0 on success, -errno on failure.
   260	 */
   261	int virtsnd_ctl_query_info(struct virtio_snd *snd, int command, int start_id,
   262				   int count, size_t size, void *info)
   263	{
   264		struct virtio_device *vdev = snd->vdev;
   265		struct virtio_snd_msg *msg;
   266		struct virtio_snd_query_info *query;
   267		struct scatterlist sg;
   268	
   269		msg = virtsnd_ctl_msg_alloc(sizeof(*query),
   270					    sizeof(struct virtio_snd_hdr), GFP_KERNEL);
   271		if (!msg)
   272			return -ENOMEM;
   273	
   274		query = virtsnd_ctl_msg_request(msg);
 > 275		query->hdr.code = cpu_to_virtio32(vdev, command);
 > 276		query->start_id = cpu_to_virtio32(vdev, start_id);
 > 277		query->count = cpu_to_virtio32(vdev, count);
 > 278		query->size = cpu_to_virtio32(vdev, size);
   279	
   280		sg_init_one(&sg, info, count * size);
   281	
   282		return virtsnd_ctl_msg_send(snd, msg, NULL, &sg, false);
   283	}
   284	

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

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 30463 bytes --]

                 reply	other threads:[~2021-02-19 11:40 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202102191920.WhsLTGaP-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=anton.yakovlev@opensynergy.com \
    --cc=kbuild-all@lists.01.org \
    --cc=linux-mm@kvack.org \
    --cc=mst@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).