linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [linux-next:master 8900/10945] drivers/gpio/gpio-virtio.c:58:19: sparse: sparse: incorrect type in assignment (different base types)
@ 2021-08-27 21:19 kernel test robot
  2021-08-31  5:29 ` Viresh Kumar
  0 siblings, 1 reply; 2+ messages in thread
From: kernel test robot @ 2021-08-27 21:19 UTC (permalink / raw)
  To: Viresh Kumar
  Cc: kbuild-all, Linux Memory Management List, Bartosz Golaszewski,
	Linus Walleij

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

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   5e63226c72287bc6c6724d4fc7e157af0e3d7908
commit: 3a29355a22c0275fe864100794fee58a73175d93 [8900/10945] gpio: Add virtio-gpio driver
config: alpha-allmodconfig (attached as .config)
compiler: alpha-linux-gcc (GCC) 11.2.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-348-gf0e6938b-dirty
        # https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=3a29355a22c0275fe864100794fee58a73175d93
        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 3a29355a22c0275fe864100794fee58a73175d93
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=alpha 

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 >>)
>> drivers/gpio/gpio-virtio.c:58:19: sparse: sparse: incorrect type in assignment (different base types) @@     expected unsigned short [usertype] type @@     got restricted __le16 [usertype] @@
   drivers/gpio/gpio-virtio.c:58:19: sparse:     expected unsigned short [usertype] type
   drivers/gpio/gpio-virtio.c:58:19: sparse:     got restricted __le16 [usertype]
>> drivers/gpio/gpio-virtio.c:59:19: sparse: sparse: incorrect type in assignment (different base types) @@     expected unsigned short [usertype] gpio @@     got restricted __le16 [usertype] @@
   drivers/gpio/gpio-virtio.c:59:19: sparse:     expected unsigned short [usertype] gpio
   drivers/gpio/gpio-virtio.c:59:19: sparse:     got restricted __le16 [usertype]
>> drivers/gpio/gpio-virtio.c:296:35: sparse: sparse: cast to restricted __le32
>> drivers/gpio/gpio-virtio.c:297:25: sparse: sparse: cast to restricted __le16

vim +58 drivers/gpio/gpio-virtio.c

    39	
    40	static int _virtio_gpio_req(struct virtio_gpio *vgpio, u16 type, u16 gpio,
    41				    u8 txvalue, u8 *rxvalue, void *response, u32 rxlen)
    42	{
    43		struct virtio_gpio_line *line = &vgpio->lines[gpio];
    44		struct virtio_gpio_request *req = &line->req;
    45		struct virtio_gpio_response *res = response;
    46		struct scatterlist *sgs[2], req_sg, res_sg;
    47		struct device *dev = &vgpio->vdev->dev;
    48		int ret;
    49	
    50		/*
    51		 * Prevent concurrent requests for the same line since we have
    52		 * pre-allocated request/response buffers for each GPIO line. Moreover
    53		 * Linux always accesses a GPIO line sequentially, so this locking shall
    54		 * always go through without any delays.
    55		 */
    56		mutex_lock(&line->lock);
    57	
  > 58		req->type = cpu_to_le16(type);
  > 59		req->gpio = cpu_to_le16(gpio);
    60		req->value = txvalue;
    61	
    62		sg_init_one(&req_sg, req, sizeof(*req));
    63		sg_init_one(&res_sg, res, rxlen);
    64		sgs[0] = &req_sg;
    65		sgs[1] = &res_sg;
    66	
    67		line->rxlen = 0;
    68		reinit_completion(&line->completion);
    69	
    70		/*
    71		 * Virtqueue callers need to ensure they don't call its APIs with other
    72		 * virtqueue operations at the same time.
    73		 */
    74		mutex_lock(&vgpio->lock);
    75		ret = virtqueue_add_sgs(vgpio->request_vq, sgs, 1, 1, line, GFP_KERNEL);
    76		if (ret) {
    77			dev_err(dev, "failed to add request to vq\n");
    78			mutex_unlock(&vgpio->lock);
    79			goto out;
    80		}
    81	
    82		virtqueue_kick(vgpio->request_vq);
    83		mutex_unlock(&vgpio->lock);
    84	
    85		if (!wait_for_completion_timeout(&line->completion, HZ)) {
    86			dev_err(dev, "GPIO operation timed out\n");
    87			ret = -ETIMEDOUT;
    88			goto out;
    89		}
    90	
    91		if (unlikely(res->status != VIRTIO_GPIO_STATUS_OK)) {
    92			dev_err(dev, "GPIO request failed: %d\n", gpio);
    93			ret = -EINVAL;
    94			goto out;
    95		}
    96	
    97		if (unlikely(line->rxlen != rxlen)) {
    98			dev_err(dev, "GPIO operation returned incorrect len (%u : %u)\n",
    99				rxlen, line->rxlen);
   100			ret = -EINVAL;
   101			goto out;
   102		}
   103	
   104		if (rxvalue)
   105			*rxvalue = res->value;
   106	
   107	out:
   108		mutex_unlock(&line->lock);
   109		return ret;
   110	}
   111	

---
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: 68094 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [linux-next:master 8900/10945] drivers/gpio/gpio-virtio.c:58:19: sparse: sparse: incorrect type in assignment (different base types)
  2021-08-27 21:19 [linux-next:master 8900/10945] drivers/gpio/gpio-virtio.c:58:19: sparse: sparse: incorrect type in assignment (different base types) kernel test robot
@ 2021-08-31  5:29 ` Viresh Kumar
  0 siblings, 0 replies; 2+ messages in thread
From: Viresh Kumar @ 2021-08-31  5:29 UTC (permalink / raw)
  To: kernel test robot
  Cc: kbuild-all, Linux Memory Management List, Bartosz Golaszewski,
	Linus Walleij

On 28-08-21, 05:19, kernel test robot wrote:
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
> head:   5e63226c72287bc6c6724d4fc7e157af0e3d7908
> commit: 3a29355a22c0275fe864100794fee58a73175d93 [8900/10945] gpio: Add virtio-gpio driver
> config: alpha-allmodconfig (attached as .config)
> compiler: alpha-linux-gcc (GCC) 11.2.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-348-gf0e6938b-dirty
>         # https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=3a29355a22c0275fe864100794fee58a73175d93
>         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 3a29355a22c0275fe864100794fee58a73175d93
>         # save the attached .config to linux build tree
>         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=alpha 
> 
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@intel.com>

Sent a patch to fix these. Thanks.

-- 
viresh


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-08-31  5:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-27 21:19 [linux-next:master 8900/10945] drivers/gpio/gpio-virtio.c:58:19: sparse: sparse: incorrect type in assignment (different base types) kernel test robot
2021-08-31  5:29 ` Viresh Kumar

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).