From: Atish Patra Date: Wed, 20 Jul 2022 14:50:35 -0700 Subject: [PATCH v3 4/4] lib: sbi: Fix fw_event_map initialization In-Reply-To: <20220720215035.3453553-1-atishp@rivosinc.com> References: <20220720215035.3453553-1-atishp@rivosinc.com> Message-ID: <20220720215035.3453553-5-atishp@rivosinc.com> List-Id: To: opensbi@lists.infradead.org MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit fw_event_map represents array of firmware events. It should initialized for maximum number of firmware events not counters. Reviewed-by: Andrew Jones Signed-off-by: Atish Patra --- lib/sbi/sbi_pmu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/sbi/sbi_pmu.c b/lib/sbi/sbi_pmu.c index ae3c00374058..b4342971bcf1 100644 --- a/lib/sbi/sbi_pmu.c +++ b/lib/sbi/sbi_pmu.c @@ -764,7 +764,7 @@ static void pmu_reset_event_map(u32 hartid) /* Initialize the counter to event mapping table */ for (j = 3; j < total_ctrs; j++) active_events[hartid][j] = SBI_PMU_EVENT_IDX_INVALID; - for (j = 0; j < SBI_PMU_FW_CTR_MAX; j++) + for (j = 0; j < SBI_PMU_FW_EVENT_MAX; j++) sbi_memset(&fw_event_map[hartid][j], 0, sizeof(struct sbi_pmu_fw_event)); } -- 2.25.1