[PATCH] x86/unwind/orc: Remove redundant initialization of 'mid'

From: Yang Li
Date: Mon May 10 2021 - 05:43:45 EST


Pointer mid is being initialized however this value is never
read as mid is assigned an updated value in while statement.
Remove the redundant initialization. At the same time, adjust the
declarations order of variables to keep the "upside-down x-mas tree"
look of them.

Clean up clang warning:

arch/x86/kernel/unwind_orc.c:38:7: warning: Value stored to 'mid' during
its initialization is never read [clang-analyzer-deadcode.DeadStores]

Reported-by: Abaci Robot <abaci@xxxxxxxxxxxxxxxxx>
Signed-off-by: Yang Li <yang.lee@xxxxxxxxxxxxxxxxx>
---
arch/x86/kernel/unwind_orc.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kernel/unwind_orc.c b/arch/x86/kernel/unwind_orc.c
index a120253..bb76f4f 100644
--- a/arch/x86/kernel/unwind_orc.c
+++ b/arch/x86/kernel/unwind_orc.c
@@ -33,9 +33,10 @@ static inline unsigned long orc_ip(const int *ip)
static struct orc_entry *__orc_find(int *ip_table, struct orc_entry *u_table,
unsigned int num_entries, unsigned long ip)
{
- int *first = ip_table;
int *last = ip_table + num_entries - 1;
- int *mid = first, *found = first;
+ int *first = ip_table;
+ int *found = first;
+ int *mid;

if (!num_entries)
return NULL;
--
1.8.3.1