Browse Source

msm: camera: isp: Fix KW issues in CSID driver

This commit fixes the KW issues in CSID Driver while
fetching the index for UDI.

CRs-Fixed: 3484948
Change-Id: Ia7a7dbd2f4ace71830f3a652874cc1cc321a5ef6
Signed-off-by: Gaurav Jindal <[email protected]>
Gaurav Jindal 2 years ago
parent
commit
2565267811
1 changed files with 11 additions and 4 deletions
  1. 11 4
      drivers/cam_isp/isp_hw_mgr/isp_hw/ife_csid_hw/cam_ife_csid_hw_ver1.c

+ 11 - 4
drivers/cam_isp/isp_hw_mgr/isp_hw/ife_csid_hw/cam_ife_csid_hw_ver1.c

@@ -791,7 +791,7 @@ static int cam_ife_csid_ver1_deinit_udi_path(
 	soc_info = &csid_hw->hw_info->soc_info;
 	csid_reg = (struct cam_ife_csid_ver1_reg_info *)core_info->csid_reg;
 
-	id =  res->res_id > CAM_IFE_PIX_PATH_RES_UDI_0;
+	id =  res->res_id - CAM_IFE_PIX_PATH_RES_UDI_0;
 	path_reg = csid_reg->udi_reg[id];
 
 	if (!path_reg) {
@@ -1046,7 +1046,8 @@ static int cam_ife_csid_ver1_stop_udi_path(
 		return -EINVAL;
 	}
 
-	if (res->res_id >= CAM_IFE_PIX_PATH_RES_MAX) {
+	if (res->res_id < CAM_IFE_PIX_PATH_RES_UDI_0 ||
+			res->res_id > CAM_IFE_PIX_PATH_RES_UDI_2) {
 		CAM_DBG(CAM_ISP, "CSID:%d Invalid res id%d",
 			csid_hw->hw_intf->hw_idx, res->res_id);
 		return -EINVAL;
@@ -1923,7 +1924,7 @@ static int cam_ife_csid_ver1_start_udi_path(
 	soc_info = &csid_hw->hw_info->soc_info;
 	csid_reg = (struct cam_ife_csid_ver1_reg_info *)core_info->csid_reg;
 
-	id = res->res_id - CAM_IFE_PIX_PATH_RES_UDI_2;
+	id = res->res_id - CAM_IFE_PIX_PATH_RES_UDI_0;
 
 	path_reg = csid_reg->udi_reg[id];
 
@@ -2308,8 +2309,14 @@ static int cam_ife_csid_ver1_init_config_udi_path(
 	csid_reg = (struct cam_ife_csid_ver1_reg_info *)
 			csid_hw->core_info->csid_reg;
 
-	id = res->res_id - CAM_IFE_PIX_PATH_RES_UDI_0;
+	if (res->res_id < CAM_IFE_PIX_PATH_RES_UDI_0 ||
+			res->res_id > CAM_IFE_PIX_PATH_RES_UDI_2) {
+		CAM_DBG(CAM_ISP, "CSID:%d Invalid res id%d",
+			csid_hw->hw_intf->hw_idx, res->res_id);
+		return -EINVAL;
+	}
 
+	id = res->res_id - CAM_IFE_PIX_PATH_RES_UDI_0;
 	if (!csid_reg->udi_reg[id]) {
 		CAM_ERR(CAM_ISP, "CSID:%d UDI:%d is not supported on HW",
 			 csid_hw->hw_intf->hw_idx, res->res_id);