Skip to contentSkip to conversation

riscv: perf_event: Remove redundant initialization of variable ret

PATCH In review Colin Ian King 2 participants 2 messages Nov 26, 2021 – Nov 27, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 riscv: perf_event: Remove redundant initialization of variable ret

The variable ret is being initialized with a value that is never read, it is being updated later on. The assignment is redundant and can be removed. Clean up the incorrectly indented following declaration of variable code and move to the same line as the declaration of variable ret.

---
 arch/riscv/kernel/perf_event.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
arch/riscv/kernel/perf_event.c +1 -2
index c835f0362d94..cf3e2ac9bbb2 100644
@@ -156,8 +156,7 @@ static int riscv_map_cache_decode(u64 config, unsigned int *type,
 static int riscv_map_cache_event(u64 config)
 {
 	unsigned int type, op, result;
-	int err = -ENOENT;
-		int code;
+	int err, code;
 
 	err = riscv_map_cache_decode(config, &type, &op, &result);
 	if (!riscv_pmu->cache_events || err)
Signature · 7 lines
2.33.1


_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv
#1 lore raw
Quoted 7 lines · Colin Ian King

The variable ret is being initialized with a value that is never read, it is being updated later on. The assignment is redundant and can be removed. Clean up the incorrectly indented following declaration of variable code and move to the same line as the declaration of variable ret.

Quoted 5 lines
---
 arch/riscv/kernel/perf_event.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

This file will be removed in favor of a platform driver that has more rich support for perf.
https://lkml.org/lkml/2021/10/25/1427

Quoted 22 lines
arch/riscv/kernel/perf_event.c +1 -3
index c835f0362d94..cf3e2ac9bbb2 100644
@@ -156,8 +156,7 @@ static int riscv_map_cache_decode(u64 config, unsigned int *type,
 static int riscv_map_cache_event(u64 config)
 {
        unsigned int type, op, result;
-       int err = -ENOENT;
-               int code;
+       int err, code;
 
        err = riscv_map_cache_decode(config, &type, &op, &result);
        if (!riscv_pmu->cache_events || err)
--

2.33.1

_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv

Signature · 7 lines
Regards,
Atish

_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv