Merge "Avoid integer underflow involving maxFreqCount." am: c282248fd7 am: 81fa7ee9c3 am: 493dc25242

Original change: https://android-review.googlesource.com/c/platform/frameworks/native/+/1558465

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I0db6e64ae7aa4a4e83e2781746e50c30d10db61e
diff --git a/libs/cputimeinstate/cputimeinstate.cpp b/libs/cputimeinstate/cputimeinstate.cpp
index 2e72cc4..462f0db 100644
--- a/libs/cputimeinstate/cputimeinstate.cpp
+++ b/libs/cputimeinstate/cputimeinstate.cpp
@@ -99,7 +99,7 @@
     struct dirent **dirlist;
     const char basepath[] = "/sys/devices/system/cpu/cpufreq";
     int ret = scandir(basepath, &dirlist, isPolicyFile, comparePolicyFiles);
-    if (ret == -1) return false;
+    if (ret == -1 || ret == 0) return false;
     gNPolicies = ret;
 
     std::vector<std::string> policyFileNames;