瀏覽代碼

msm: camera: reqmgr: Dead code removal

This change removes some unused variables and
checks bounds for an index in camera driver.

CRs-Fixed: 3394193
Change-Id: I1e38834f09a4ef9717787e87df8689ab2541fd84
Signed-off-by: Atiya Kailany <[email protected]>
Atiya Kailany 2 年之前
父節點
當前提交
e9fba3cc33
共有 2 個文件被更改,包括 17 次插入5 次删除
  1. 17 2
      drivers/cam_req_mgr/cam_req_mgr_core.c
  2. 0 3
      drivers/cam_req_mgr/cam_req_mgr_workq.c

+ 17 - 2
drivers/cam_req_mgr/cam_req_mgr_core.c

@@ -441,6 +441,12 @@ static int __cam_req_mgr_notify_frame_skip(
 
 	apply_data = link->req.prev_apply_data;
 
+	if (link->max_delay < 0 || link->max_delay >= CAM_PIPELINE_DELAY_MAX) {
+		CAM_ERR(CAM_CRM, "link->max_delay is out of bounds: %d",
+			link->max_delay);
+		return -EINVAL;
+	}
+
 	for (i = 0; i < link->num_devs; i++) {
 		dev = &link->l_dev[i];
 		pd = dev->dev_info.p_delay;
@@ -1203,6 +1209,12 @@ static int __cam_req_mgr_send_req(struct cam_req_mgr_core_link *link,
 	else
 		apply_req.recovery = false;
 
+	if (link->max_delay < 0 || link->max_delay >= CAM_PIPELINE_DELAY_MAX) {
+		CAM_ERR(CAM_CRM, "link->max_delay is out of bounds: %d",
+			link->max_delay);
+		return -EINVAL;
+	}
+
 	apply_data = link->req.apply_data;
 
 	/*
@@ -1829,7 +1841,6 @@ static int __cam_req_mgr_check_sync_req_is_ready(
 	if (sync_slot_idx == -1) {
 		CAM_DBG(CAM_CRM, "Req: %lld not found on link: %x [other link]",
 			req_id, sync_link->link_hdl);
-		sync_ready = false;
 		return -EAGAIN;
 	}
 
@@ -5312,6 +5323,10 @@ int cam_req_mgr_flush_requests(
 	task->process_cb = &cam_req_mgr_process_flush_req;
 	init_completion(&link->workq_comp);
 	rc = cam_req_mgr_workq_enqueue_task(task, link, CRM_TASK_PRIORITY_0);
+	if (rc) {
+		CAM_ERR(CAM_CRM, "Failed to queue flush task rc: %d", rc);
+		goto end;
+	}
 
 	/* Blocking call */
 	rc = cam_common_wait_for_completion_timeout(
@@ -5534,7 +5549,7 @@ int cam_req_mgr_dump_request(struct cam_dump_req_cmd *dump_req)
 		dump_req->issue_req_id, dump_req->offset);
 end:
 	mutex_unlock(&g_crm_core_dev->crm_lock);
-	return 0;
+	return rc;
 }
 
 static unsigned long cam_req_mgr_core_mini_dump_cb(void *dst, unsigned long len,

+ 0 - 3
drivers/cam_req_mgr/cam_req_mgr_workq.c

@@ -83,12 +83,9 @@ void cam_req_mgr_workq_flush(struct cam_req_mgr_core_workq *workq)
  */
 static int cam_req_mgr_process_task(struct crm_workq_task *task)
 {
-	struct cam_req_mgr_core_workq *workq = NULL;
-
 	if (!task)
 		return -EINVAL;
 
-	workq = (struct cam_req_mgr_core_workq *)task->parent;
 	if (task->process_cb)
 		task->process_cb(task->priv, task->payload);
 	else