Using unreachable() at default of switch generates an extra branch at
end of the function, and compiler won't generate a ret to close this
branch because it knows it's unreachable.
If there's no instruction in this branch, compiler will generate a NOP,
And it will confuse objtool to warn this NOP as a fall through branch.
In fact these branches are actually unreachable, so we can replace
unreachable() with returning a -EINVAL value.
Signed-off-by: Chen Zhongjin <chenzhongjin@xxxxxxxxxx>
---
arch/arm64/kvm/hyp/vgic-v3-sr.c | 7 +++----
drivers/irqchip/irq-gic-v3.c | 2 +-
2 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/arch/arm64/kvm/hyp/vgic-v3-sr.c b/arch/arm64/kvm/hyp/vgic-v3-sr.c
index 4fb419f7b8b6..f3cee92c3038 100644
--- a/arch/arm64/kvm/hyp/vgic-v3-sr.c
+++ b/arch/arm64/kvm/hyp/vgic-v3-sr.c
@@ -6,7 +6,6 @@
#include <hyp/adjust_pc.h>
-#include <linux/compiler.h>
#include <linux/irqchip/arm-gic-v3.h>
#include <linux/kvm_host.h>
@@ -55,7 +54,7 @@ static u64 __gic_v3_get_lr(unsigned int lr)
return read_gicreg(ICH_LR15_EL2);
}
- unreachable();
+ return -EINVAL;