Ver código fonte

msm: camera: req_mgr: Link state check before process trigger workq

Due to scheduling delays, process trigger workq can be delayed.
In the meantime, link state can be reset to IDLE. This can cause
abnormal behaviour resulting in stability issues. Also, at the
time of apply  fail for flash, failed_dev is not updated.
This causes crash while notifying the error on link.
This commit prevents the execution of workq process trigger if
the link has been reset to IDLE state.
Also, failed_dev is updated if the apply for flash fails.

CRs-Fixed: 2572511
Change-Id: Iaea1e0a7a24afc9e408a1530a5875f6b6c41a45b
Signed-off-by: Gaurav Jindal <[email protected]>
Gaurav Jindal 5 anos atrás
pai
commit
65f749c831
1 arquivos alterados com 11 adições e 1 exclusões
  1. 11 1
      drivers/cam_req_mgr/cam_req_mgr_core.c

+ 11 - 1
drivers/cam_req_mgr/cam_req_mgr_core.c

@@ -681,8 +681,10 @@ static int __cam_req_mgr_send_req(struct cam_req_mgr_core_link *link,
 		apply_req.trigger_point = trigger;
 		if (dev->ops && dev->ops->apply_req) {
 			rc = dev->ops->apply_req(&apply_req);
-			if (rc)
+			if (rc) {
+				*failed_dev = dev;
 				return rc;
+			}
 			CAM_DBG(CAM_REQ,
 				"SEND: link_hdl: %x pd: %d req_id %lld",
 				link->link_hdl, pd, apply_req.request_id);
@@ -2456,6 +2458,14 @@ static int cam_req_mgr_process_trigger(void *priv, void *data)
 		link->link_hdl, in_q->rd_idx, in_q->slot[in_q->rd_idx].status);
 
 	spin_lock_bh(&link->link_state_spin_lock);
+
+	if (link->state < CAM_CRM_LINK_STATE_READY) {
+		CAM_WARN(CAM_CRM, "invalid link state:%d", link->state);
+		spin_unlock_bh(&link->link_state_spin_lock);
+		rc = -EPERM;
+		goto release_lock;
+	}
+
 	if (link->state == CAM_CRM_LINK_STATE_ERR)
 		CAM_WARN(CAM_CRM, "Error recovery idx %d status %d",
 			in_q->rd_idx,