]> git.baikalelectronics.ru Git - kernel.git/commit
s390: add unreachable() to dump_fault_info() to fix -Wmaybe-uninitialized
authorMasahiro Yamada <yamada.masahiro@socionext.com>
Fri, 17 May 2019 06:49:22 +0000 (15:49 +0900)
committerHeiko Carstens <heiko.carstens@de.ibm.com>
Tue, 28 May 2019 12:49:21 +0000 (14:49 +0200)
commit5c58ccf1f4ce91293a5c8cb5458daf2cb504ec9a
tree495bc773550474e2e4523933baefe00e9e04dcf2
parent54303dc5c2ec89237d4f7dc180544d5c092cbf3f
s390: add unreachable() to dump_fault_info() to fix -Wmaybe-uninitialized

When CONFIG_OPTIMIZE_INLINING is enabled for s390, I see this warning:

arch/s390/mm/fault.c:127:15: warning: 'asce' may be used uninitialized in this function [-Wmaybe-uninitialized]
  switch (asce & _ASCE_TYPE_MASK) {
arch/s390/mm/fault.c:177:16: note: 'asce' was declared here
  unsigned long asce;
                ^~~~

If get_fault_type() is not inlined, the compiler cannot deduce that
all the possible paths in the 'switch' statement are covered.

Of course, we could mark get_fault_type() as __always_inline to get
back the original behavior, but I do not think it sensible to force
inlining just for the purpose of suppressing the warning. Since this
is just a matter of warning, I want to keep as much room for compiler
optimization as possible.

I added unreachable() to teach the compiler that the 'default' label
is unreachable.

I got rid of the 'inline' marker. Even without the 'inline' hint,
the compiler inlines functions based on its inlining heuristic.

Fixes: f9797d32f5a3 ("compiler: allow all arches to enable CONFIG_OPTIMIZE_INLINING")
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
arch/s390/mm/fault.c