Эх сурвалжийг харах

msm: camera: cpas: Removing dead code and unused variables

Removed dead code and variables in camera driver and
handled return value appropriately.

CRs-Fixed: 3394193
Change-Id: I42fda0ad538a23cc8967f9cbce936d22c31e72fb
Signed-off-by: Atiya Kailany <[email protected]>
Atiya Kailany 2 жил өмнө
parent
commit
44b640e8d5

+ 2 - 3
drivers/cam_cpas/cam_cpas_hw.c

@@ -815,8 +815,6 @@ static bool cam_cpas_calculate_smart_qos(
 				niu_node->bw_info[CAM_CPAS_PORT_DRV_2].drv_vote.high.camnoc +
 				niu_node->bw_info[CAM_CPAS_PORT_DRV_2].drv_vote.low.camnoc;
 
-		remainder = do_div(bw_per_kb, niu_node->niu_size); // --> dropping remainder
-
 		if ((bw_per_kb * CAM_CPAS_MAX_STRESS_INDICATOR) >
 			(total_bw_per_kb *
 			soc_private->smart_qos_info->highstress_indicator_th)) {
@@ -2447,7 +2445,6 @@ static int cam_cpas_hw_start(void *hw_priv, void *start_args,
 						rc);
 					/* Do not return error, passthrough */
 				}
-				rc = 0;
 			}
 		}
 
@@ -4338,6 +4335,8 @@ int cam_cpas_hw_probe(struct platform_device *pdev,
 		goto axi_cleanup;
 
 	rc = cam_cpas_util_create_debugfs(cpas_core);
+	if (unlikely(rc))
+		CAM_WARN(CAM_CPAS, "failed to create cpas debugfs rc: %d", rc);
 
 	*hw_intf = cpas_hw_intf;
 	return 0;

+ 26 - 23
drivers/cam_cpas/cam_cpas_soc.c

@@ -335,7 +335,7 @@ static int cam_cpas_parse_mnoc_node(struct cam_cpas *cpas_core,
 	struct cam_cpas_private_soc *soc_private, struct cam_cpas_tree_node *curr_node_ptr,
 	struct device_node *mnoc_node, int *mnoc_idx)
 {
-	int rc = 0, count = 0, i;
+	int rc = 0, count, i;
 	bool ib_voting_needed = false, is_rt_port = false;
 	struct of_phandle_args src_args = {0}, dst_args = {0};
 
@@ -347,12 +347,10 @@ static int cam_cpas_parse_mnoc_node(struct cam_cpas *cpas_core,
 		count = of_property_count_strings(mnoc_node, "interconnect-names");
 		if (count <= 0) {
 			CAM_ERR(CAM_CPAS, "no interconnect-names found");
-			count = 0;
 			return -EINVAL;
 		} else if (count > CAM_CPAS_MAX_DRV_PORTS) {
 			CAM_ERR(CAM_CPAS, "Number of interconnects %d greater than max ports %d",
 				count, CAM_CPAS_MAX_DRV_PORTS);
-			count = 0;
 			return -EINVAL;
 		}
 
@@ -628,6 +626,8 @@ static int cam_cpas_parse_node_tree(struct cam_cpas *cpas_core,
 
 			rc = of_property_read_u32(curr_node, "traffic-merge-type",
 				&curr_node_ptr->merge_type);
+			if (rc)
+				curr_node_ptr->merge_type = CAM_CPAS_TRAFFIC_MERGE_SUM;
 
 			for (j = 0; j < num_drv_ports; j++)
 				curr_node_ptr->axi_port_idx_arr[j] = -1;
@@ -718,6 +718,9 @@ static int cam_cpas_parse_node_tree(struct cam_cpas *cpas_core,
 				if (soc_private->enable_cam_ddr_drv) {
 					rc = of_property_read_u32(curr_node, "drv-voting-index",
 						&curr_node_ptr->drv_voting_idx);
+					if (rc)
+						curr_node_ptr->merge_type = CAM_CPAS_PORT_HLOS_DRV;
+
 					if (curr_node_ptr->drv_voting_idx == CAM_CPAS_PORT_DRV_DYN)
 						curr_client->is_drv_dyn = true;
 
@@ -1345,12 +1348,10 @@ int cam_cpas_get_custom_dt_info(struct cam_hw_info *cpas_hw,
 	count = of_property_count_strings(of_node, "client-names");
 	if (count <= 0) {
 		CAM_ERR(CAM_CPAS, "no client-names found");
-		count = 0;
 		return -EINVAL;
 	} else if (count > CAM_CPAS_MAX_CLIENTS) {
 		CAM_ERR(CAM_CPAS, "Number of clients %d greater than max %d",
 			count, CAM_CPAS_MAX_CLIENTS);
-		count = 0;
 		return -EINVAL;
 	}
 
@@ -1391,13 +1392,11 @@ int cam_cpas_get_custom_dt_info(struct cam_hw_info *cpas_hw,
 			goto cleanup_clients;
 		}
 
-		rc = of_property_read_u32(of_node,
+		if (of_property_read_u32(of_node,
 			"camnoc-axi-clk-bw-margin-perc",
-			&soc_private->camnoc_axi_clk_bw_margin);
+			&soc_private->camnoc_axi_clk_bw_margin)) {
 
-		if (rc) {
-			/* this is not fatal, overwrite rc */
-			rc = 0;
+			/* this is not fatal, overwrite to 0 */
 			soc_private->camnoc_axi_clk_bw_margin = 0;
 		}
 	}
@@ -1584,21 +1583,25 @@ int cam_cpas_get_custom_dt_info(struct cam_hw_info *cpas_hw,
 	}
 
 	rc = of_property_read_u32(of_node, "enable-cam-drv", &cam_drv_en_mask_val);
-	if (cam_drv_en_mask_val & CAM_DDR_DRV)
-		soc_private->enable_cam_ddr_drv = true;
 
-	if (cam_drv_en_mask_val & CAM_CLK_DRV) {
-		if (!soc_private->enable_cam_ddr_drv) {
-			CAM_ERR(CAM_CPAS, "DDR DRV needs to be enabled for Clock DRV");
-			rc = -EPERM;
-			goto cleanup_clients;
-		}
+	if (!rc) {
+		if (cam_drv_en_mask_val & CAM_DDR_DRV)
+			soc_private->enable_cam_ddr_drv = true;
 
-		soc_private->enable_cam_clk_drv = true;
-		rc = cam_soc_util_cesta_populate_crm_device();
-		if (rc) {
-			CAM_ERR(CAM_CPAS, "Failed to populate camera cesta crm device rc: %d", rc);
-			goto cleanup_clients;
+		if (cam_drv_en_mask_val & CAM_CLK_DRV) {
+			if (!soc_private->enable_cam_ddr_drv) {
+				CAM_ERR(CAM_CPAS, "DDR DRV needs to be enabled for Clock DRV");
+				rc = -EPERM;
+				goto cleanup_clients;
+			}
+
+			soc_private->enable_cam_clk_drv = true;
+			rc = cam_soc_util_cesta_populate_crm_device();
+			if (rc) {
+				CAM_ERR(CAM_CPAS, "Failed to populate cam cesta crm device rc %d",
+					rc);
+				goto cleanup_clients;
+			}
 		}
 	}
 

+ 1 - 1
drivers/cam_cpas/cpas_top/cam_cpastop_hw.c

@@ -1148,7 +1148,7 @@ static int cam_cpastop_init_hw_version(struct cam_hw_info *cpas_hw,
 		}
 	}
 
-	return 0;
+	return rc;
 }
 
 static int cam_cpastop_setup_qos_settings(struct cam_hw_info *cpas_hw,