Re: kernel/sched/core.c:5370:37: warning: cast between incompatible function types from 'long int (*)(void)' to 'int (*)(void)'

From: Peter Zijlstra
Date: Wed Mar 31 2021 - 03:33:55 EST


On Wed, Mar 31, 2021 at 02:15:41PM +0800, kernel test robot wrote:
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> head: 5e46d1b78a03d52306f21f77a4e4a144b6d31486
> commit: 826bfeb37bb4302ee6042f330c4c0c757152bdb8 preempt/dynamic: Support dynamic preempt with preempt= boot option
> date: 6 weeks ago
> config: x86_64-randconfig-r011-20210331 (attached as .config)
> compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
> reproduce (this is a W=1 build):
> # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=826bfeb37bb4302ee6042f330c4c0c757152bdb8
> git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
> git fetch --no-tags linus master
> git checkout 826bfeb37bb4302ee6042f330c4c0c757152bdb8
> # save the attached .config to linux build tree
> make W=1 ARCH=x86_64
>
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@xxxxxxxxx>
>
> All warnings (new ones prefixed by >>):
>
> kernel/sched/core.c: In function 'schedule_tail':
> kernel/sched/core.c:4252:13: warning: variable 'rq' set but not used [-Wunused-but-set-variable]
> 4252 | struct rq *rq;
> | ^~
> In file included from include/linux/err.h:5,
> from include/linux/kthread.h:5,
> from include/trace/events/sched.h:8,
> from kernel/sched/core.c:10:
> kernel/sched/core.c: In function 'setup_preempt_mode':
> >> kernel/sched/core.c:5370:37: warning: cast between incompatible function types from 'long int (*)(void)' to 'int (*)(void)' [-Wcast-function-type]

That warning is broken IMO.

Still, I have a patch for this somewhere.. I'll try and push it out
sometime soon.