|
@@ -1938,6 +1938,12 @@ static int cam_soc_util_get_dt_regulator_info
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
+ if (soc_info->num_rgltr > CAM_SOC_MAX_REGULATOR) {
|
|
|
+ CAM_ERR(CAM_UTIL, "Invalid regulator count:%d",
|
|
|
+ soc_info->num_rgltr);
|
|
|
+ return -EINVAL;
|
|
|
+ }
|
|
|
+
|
|
|
for (i = 0; i < soc_info->num_rgltr; i++) {
|
|
|
rc = of_property_read_string_index(of_node,
|
|
|
"regulator-names", i, &soc_info->rgltr_name[i]);
|
|
@@ -2393,6 +2399,13 @@ static int cam_soc_util_regulator_enable_default(
|
|
|
int j = 0, rc = 0;
|
|
|
uint32_t num_rgltr = soc_info->num_rgltr;
|
|
|
|
|
|
+ if (num_rgltr > CAM_SOC_MAX_REGULATOR) {
|
|
|
+ CAM_ERR(CAM_UTIL,
|
|
|
+ "%s has invalid regulator number %d",
|
|
|
+ soc_info->dev_name, num_rgltr);
|
|
|
+ return -EINVAL;
|
|
|
+ }
|
|
|
+
|
|
|
for (j = 0; j < num_rgltr; j++) {
|
|
|
if (soc_info->rgltr_ctrl_support == true) {
|
|
|
rc = cam_soc_util_regulator_enable(soc_info->rgltr[j],
|