On Tue, 2019-10-01 at 16:22 +0200, Arnd Bergmann wrote: > Removing the mem_cgroup_id_get() stub function introduced a new warning > of the same kind when CONFIG_MMU is disabled: Shouldn't CONFIG_MEMCG depends on CONFIG_MMU instead? > > mm/memcontrol.c:4929:13: error: unused function 'mem_cgroup_id_get_many' [-Werror,-Wunused-function] > > Address this using a __maybe_unused annotation. > > Note: alternatively, this could be moved into an #ifdef block. Marking it > 'static inline' would not work here as that would still produce the > warning on clang, which only ignores unused inline functions declared > in header files instead of .c files. > > Fixes: 4d0e3230a56a ("mm/memcontrol.c: fix a -Wunused-function warning") > Signed-off-by: Arnd Bergmann <arnd@xxxxxxxx> > --- > mm/memcontrol.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/mm/memcontrol.c b/mm/memcontrol.c > index c313c49074ca..5f9f90e3cef8 100644 > --- a/mm/memcontrol.c > +++ b/mm/memcontrol.c > @@ -4921,7 +4921,8 @@ static void mem_cgroup_id_remove(struct mem_cgroup *memcg) > } > } > > -static void mem_cgroup_id_get_many(struct mem_cgroup *memcg, unsigned int n) > +static void __maybe_unused > +mem_cgroup_id_get_many(struct mem_cgroup *memcg, unsigned int n) > { > refcount_add(n, &memcg->id.ref); > }