From ccac064757d207748c73318905b1af8a8ce57776 Mon Sep 17 00:00:00 2001 From: Galaxy Date: Tue, 4 Jun 2024 23:44:17 -0700 Subject: [PATCH] Fix bug: Incorrect error code return from PmuRead On some environment which does not support SPE, error code will be returned from PmuRead. But currently PmuRead always return SUCCESS. Set SUCCESS before calling Read(), if there is any error code in Read(), SUCCESS will be override. --- pmu/pmu.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pmu/pmu.cpp b/pmu/pmu.cpp index 53bf707..e3c3a4e 100644 --- a/pmu/pmu.cpp +++ b/pmu/pmu.cpp @@ -550,8 +550,8 @@ int PmuRead(int pd, struct PmuData** pmuData) return -1; } - auto& retData = KUNPENG_PMU::PmuList::GetInstance()->Read(pd); New(SUCCESS); + auto& retData = KUNPENG_PMU::PmuList::GetInstance()->Read(pd); if (!retData.empty()) { *pmuData = retData.data(); return retData.size(); -- Gitee