diff options
author | Masahiro Yamada <yamada.masahiro@socionext.com> | 2019-05-17 02:49:22 -0400 |
---|---|---|
committer | Heiko Carstens <heiko.carstens@de.ibm.com> | 2019-05-28 08:49:21 -0400 |
commit | bf2f1eeed0b5461ecda385f1716c2b65add54579 (patch) | |
tree | 495bc773550474e2e4523933baefe00e9e04dcf2 | |
parent | 2409207a73cc8e4aff75ceccf6fe5c3ce4d391bc (diff) |
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: 9012d011660e ("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>
-rw-r--r-- | arch/s390/mm/fault.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/arch/s390/mm/fault.c b/arch/s390/mm/fault.c index c220399ae196..91ce03fd0c84 100644 --- a/arch/s390/mm/fault.c +++ b/arch/s390/mm/fault.c | |||
@@ -85,7 +85,7 @@ static inline int notify_page_fault(struct pt_regs *regs) | |||
85 | * Find out which address space caused the exception. | 85 | * Find out which address space caused the exception. |
86 | * Access register mode is impossible, ignore space == 3. | 86 | * Access register mode is impossible, ignore space == 3. |
87 | */ | 87 | */ |
88 | static inline enum fault_type get_fault_type(struct pt_regs *regs) | 88 | static enum fault_type get_fault_type(struct pt_regs *regs) |
89 | { | 89 | { |
90 | unsigned long trans_exc_code; | 90 | unsigned long trans_exc_code; |
91 | 91 | ||
@@ -211,6 +211,8 @@ static void dump_fault_info(struct pt_regs *regs) | |||
211 | asce = S390_lowcore.kernel_asce; | 211 | asce = S390_lowcore.kernel_asce; |
212 | pr_cont("kernel "); | 212 | pr_cont("kernel "); |
213 | break; | 213 | break; |
214 | default: | ||
215 | unreachable(); | ||
214 | } | 216 | } |
215 | pr_cont("ASCE.\n"); | 217 | pr_cont("ASCE.\n"); |
216 | dump_pagetable(asce, regs->int_parm_long & __FAIL_ADDR_MASK); | 218 | dump_pagetable(asce, regs->int_parm_long & __FAIL_ADDR_MASK); |