Skip to contentSkip to conversation

ARC: perf: Remove redundant initialization of variable idx

PATCH In review Colin Ian King 3 participants 3 messages Nov 26, 2021 – Dec 29, 2021

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

PATCH 1/1 ARC: perf: Remove redundant initialization of variable idx

The variable idx is being initialized with a value that is never read, it is being updated later on. The assignment is redundant and can be removed.

---
 arch/arc/kernel/perf_event.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arc/kernel/perf_event.c +1 -1
index 145722f80c9b..f5dd799ddb9e 100644
@@ -361,7 +361,7 @@ static int arc_pmu_add(struct perf_event *event, int flags)
 {
 	struct arc_pmu_cpu *pmu_cpu = this_cpu_ptr(&arc_pmu_cpu);
 	struct hw_perf_event *hwc = &event->hw;
-	int idx = hwc->idx;
+	int idx;
 
 	idx = ffz(pmu_cpu->used_mask[0]);
 	if (idx == arc_pmu->n_counters)
Signature · 7 lines
2.33.1


_______________________________________________
linux-snps-arc mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-snps-arc
Acked-by on v1 1/1
#1 lore raw
Quoted 23 lines · Colin Ian King

The variable idx is being initialized with a value that is never read, it is being updated later on. The assignment is redundant and can be removed.

---
 arch/arc/kernel/perf_event.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arc/kernel/perf_event.c +1 -1
index 145722f80c9b..f5dd799ddb9e 100644
@@ -361,7 +361,7 @@ static int arc_pmu_add(struct perf_event *event, int
 flags)
 {
 	struct arc_pmu_cpu *pmu_cpu = this_cpu_ptr(&arc_pmu_cpu);
 	struct hw_perf_event *hwc = &event->hw;
-	int idx = hwc->idx;
+	int idx;
 
 	idx = ffz(pmu_cpu->used_mask[0]);
Quoted 4 lines

if (idx == arc_pmu->n_counters)
--
2.33.1

Thank you,
Vladimir Isaev

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