[jsarha:topic/cros-sof-v4.19 949/6555] mm/low-mem-notify.c:87:16: sparse: sparse: incorrect type in return expression (different base types)

From: kernel test robot
Date: Wed May 11 2022 - 22:01:25 EST


tree: https://github.com/jsarha/linux topic/cros-sof-v4.19
head: d7a3e91d8d16d1ef8653deec5a1fffc4de034a0c
commit: b7ec7fb624dfc8d07e722cf2e0e72ff82ebaec7b [949/6555] CHROMIUM: low-mem: Fix return type of low_mem_notify_poll
config: i386-randconfig-s001-20220509 (https://download.01.org/0day-ci/archive/20220512/202205120909.GVWyvFOU-lkp@xxxxxxxxx/config)
compiler: gcc-11 (Debian 11.2.0-20) 11.2.0
reproduce:
# apt-get install sparse
# sparse version: v0.6.4-dirty
# https://github.com/jsarha/linux/commit/b7ec7fb624dfc8d07e722cf2e0e72ff82ebaec7b
git remote add jsarha https://github.com/jsarha/linux
git fetch --no-tags jsarha topic/cros-sof-v4.19
git checkout b7ec7fb624dfc8d07e722cf2e0e72ff82ebaec7b
# save the config file
mkdir build_dir && cp config build_dir/.config
make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=i386 SHELL=/bin/bash

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


sparse warnings: (new ones prefixed by >>)
>> mm/low-mem-notify.c:87:16: sparse: sparse: incorrect type in return expression (different base types) @@ expected restricted __poll_t @@ got unsigned int [assigned] ret @@
mm/low-mem-notify.c:87:16: sparse: expected restricted __poll_t
mm/low-mem-notify.c:87:16: sparse: got unsigned int [assigned] ret

vim +87 mm/low-mem-notify.c

89587e9d1c30b5 Luigi Semenzato 2014-04-03 74
b7ec7fb624dfc8 Guenter Roeck 2018-11-01 75 static __poll_t low_mem_notify_poll(struct file *file, poll_table *wait)
89587e9d1c30b5 Luigi Semenzato 2014-04-03 76 {
89587e9d1c30b5 Luigi Semenzato 2014-04-03 77 unsigned int ret = 0;
89587e9d1c30b5 Luigi Semenzato 2014-04-03 78
89587e9d1c30b5 Luigi Semenzato 2014-04-03 79 /* Update state to reflect any recent freeing. */
89587e9d1c30b5 Luigi Semenzato 2014-04-03 80 atomic_set(&low_mem_state, is_low_mem_situation());
89587e9d1c30b5 Luigi Semenzato 2014-04-03 81
89587e9d1c30b5 Luigi Semenzato 2014-04-03 82 poll_wait(file, &low_mem_wait, wait);
89587e9d1c30b5 Luigi Semenzato 2014-04-03 83
1fa6b9516423e6 Luigi Semenzato 2012-04-18 84 if (low_mem_margin_enabled && atomic_read(&low_mem_state) != 0)
89587e9d1c30b5 Luigi Semenzato 2014-04-03 85 ret = POLLIN;
89587e9d1c30b5 Luigi Semenzato 2014-04-03 86
89587e9d1c30b5 Luigi Semenzato 2014-04-03 @87 return ret;
89587e9d1c30b5 Luigi Semenzato 2014-04-03 88 }
89587e9d1c30b5 Luigi Semenzato 2014-04-03 89

:::::: The code at line 87 was first introduced by commit
:::::: 89587e9d1c30b5f908d4bfe5f2ee0b920c156c14 CHROMIUM: Add /dev/low-mem device for low-memory notification.

:::::: TO: Luigi Semenzato <semenzato@xxxxxxxxxxxx>
:::::: CC: Guenter Roeck <groeck@xxxxxxxxxxxx>

--
0-DAY CI Kernel Test Service
https://01.org/lkp