PD#119939 add array check for dvfs table for mali450
authorJiyu Yang <jiyu.yang@amlogic.com>
Fri, 11 Mar 2016 06:34:02 +0000 (14:34 +0800)
committerJiyu Yang <jiyu.yang@amlogic.com>
Tue, 15 Mar 2016 06:10:44 +0000 (22:10 -0800)
Change-Id: I9f6b40f28f6ad779c65fffae70d41987a01ab10e

mali/platform/meson_bu/scaling.c

index 1a725a11dbd0a2df84ddd46540c2d32f2a2daca6..54a6d66254bf4a9cd8ef3e444f34138e4f3e86d7 100644 (file)
@@ -405,6 +405,16 @@ static void mali_decide_next_status(struct mali_gpu_utilization_data *data, int*
                        *pp_change_flag = -1;
                }
        }
+
+       if (decided_fs_idx < 0 ) {
+               printk("gpu debug, next index below 0\n");
+               decided_fs_idx = 0;
+       }
+       if (decided_fs_idx > pmali_plat->scale_info.maxclk) {
+               decided_fs_idx = pmali_plat->scale_info.maxclk;
+               printk("gpu debug, next index above max, set to %d\n", decided_fs_idx);
+       }
+
        if (change_mode)
                mali_stay_count = pmali_plat->dvfs_table[decided_fs_idx].keep_count;
        *next_fs_idx = decided_fs_idx;