[gustavoars:testing/wfamnae-next20250124 1/15] kernel/sched/ext.c:3872:24: error: returning 'struct cgroup_hdr *' from a function with incompatible return type 'struct cgroup *'

From: kernel test robot
Date: Mon Jan 27 2025 - 05:24:55 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/gustavoars/linux.git testing/wfamnae-next20250124
head: 54447c8c7cc239e559f3b58a7a70d9b776ed9b03
commit: 3cbd577a7864cca3fe87e22054d95e2238b6592b [1/15] cgroup: Avoid -Wflex-array-member-not-at-end warnings
config: arm-randconfig-002-20250127 (https://download.01.org/0day-ci/archive/20250127/202501271831.aVHIfaqV-lkp@xxxxxxxxx/config)
compiler: arm-linux-gnueabi-gcc (GCC) 14.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250127/202501271831.aVHIfaqV-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/202501271831.aVHIfaqV-lkp@xxxxxxxxx/

All errors (new ones prefixed by >>):

In file included from kernel/sched/build_policy.c:63:
kernel/sched/ext.c: In function 'tg_cgrp':
>> kernel/sched/ext.c:3872:24: error: returning 'struct cgroup_hdr *' from a function with incompatible return type 'struct cgroup *' [-Wincompatible-pointer-types]
3872 | return &cgrp_dfl_root.cgrp;
| ^~~~~~~~~~~~~~~~~~~
kernel/sched/ext.c: In function 'scx_bpf_task_cgroup':
>> kernel/sched/ext.c:7648:31: error: initialization of 'struct cgroup *' from incompatible pointer type 'struct cgroup_hdr *' [-Wincompatible-pointer-types]
7648 | struct cgroup *cgrp = &cgrp_dfl_root.cgrp;
| ^
In file included from kernel/sched/build_policy.c:52:
kernel/sched/rt.c: At top level:
kernel/sched/rt.c:9:18: warning: 'max_rt_runtime' defined but not used [-Wunused-const-variable=]
9 | static const u64 max_rt_runtime = MAX_BW;
| ^~~~~~~~~~~~~~


vim +3872 kernel/sched/ext.c

f0e1a0643a59bf Tejun Heo 2024-06-18 3860
8195136669661f Tejun Heo 2024-09-04 3861 #ifdef CONFIG_EXT_GROUP_SCHED
8195136669661f Tejun Heo 2024-09-04 3862 static struct cgroup *tg_cgrp(struct task_group *tg)
8195136669661f Tejun Heo 2024-09-04 3863 {
8195136669661f Tejun Heo 2024-09-04 3864 /*
8195136669661f Tejun Heo 2024-09-04 3865 * If CGROUP_SCHED is disabled, @tg is NULL. If @tg is an autogroup,
8195136669661f Tejun Heo 2024-09-04 3866 * @tg->css.cgroup is NULL. In both cases, @tg can be treated as the
8195136669661f Tejun Heo 2024-09-04 3867 * root cgroup.
8195136669661f Tejun Heo 2024-09-04 3868 */
8195136669661f Tejun Heo 2024-09-04 3869 if (tg && tg->css.cgroup)
8195136669661f Tejun Heo 2024-09-04 3870 return tg->css.cgroup;
8195136669661f Tejun Heo 2024-09-04 3871 else
8195136669661f Tejun Heo 2024-09-04 @3872 return &cgrp_dfl_root.cgrp;
8195136669661f Tejun Heo 2024-09-04 3873 }
8195136669661f Tejun Heo 2024-09-04 3874

:::::: The code at line 3872 was first introduced by commit
:::::: 8195136669661fdfe54e9a8923c33b31c92fc1da sched_ext: Add cgroup support

:::::: TO: Tejun Heo <tj@xxxxxxxxxx>
:::::: CC: Tejun Heo <tj@xxxxxxxxxx>

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