drivers/uio/uio.c:520:21: sparse: sparse: incorrect type in assignment (different base types)

From: kernel test robot
Date: Sat Feb 10 2024 - 21:03:54 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: a5b6244cf87c50358f5562b8f07f7ac35fc7f6b0
commit: a93e7b331568227500186a465fee3c2cb5dffd1f uio: Prevent device destruction while fds are open
date: 6 years ago
config: x86_64-randconfig-x051-20230705 (https://download.01.org/0day-ci/archive/20240211/202402111048.4XHz0rkp-lkp@xxxxxxxxx/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/20240211/202402111048.4XHz0rkp-lkp@xxxxxxxxx/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 <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202402111048.4XHz0rkp-lkp@xxxxxxxxx/

sparse warnings: (new ones prefixed by >>)
>> drivers/uio/uio.c:520:21: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __poll_t [usertype] ret @@ got int @@
drivers/uio/uio.c:520:21: sparse: expected restricted __poll_t [usertype] ret
drivers/uio/uio.c:520:21: sparse: got int
drivers/uio/uio.c:852: warning: expecting prototype for uio_register_device(). Prototype was for __uio_register_device() instead

vim +520 drivers/uio/uio.c

510
511 static __poll_t uio_poll(struct file *filep, poll_table *wait)
512 {
513 struct uio_listener *listener = filep->private_data;
514 struct uio_device *idev = listener->dev;
515 __poll_t ret = 0;
516 unsigned long flags;
517
518 spin_lock_irqsave(&idev->info_lock, flags);
519 if (!idev->info || !idev->info->irq)
> 520 ret = -EIO;
521 spin_unlock_irqrestore(&idev->info_lock, flags);
522
523 if (ret)
524 return ret;
525
526 poll_wait(filep, &idev->wait, wait);
527 if (listener->event_count != atomic_read(&idev->event))
528 return EPOLLIN | EPOLLRDNORM;
529 return 0;
530 }
531

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki