Browse Source

msm: camera: common: Add context flush state check

This commit add context flush state check to avoid invalid flush.

CRs-Fixed: 3034117
Change-Id: I45192f6b6255ffefedefe869badf04448dfaa5f6
Signed-off-by: zhuo <[email protected]>
zhuo 3 năm trước cách đây
mục cha
commit
5ce3274d14
1 tập tin đã thay đổi với 10 bổ sung8 xóa
  1. 10 8
      drivers/cam_core/cam_context.c

+ 10 - 8
drivers/cam_core/cam_context.c

@@ -268,7 +268,7 @@ int cam_context_handle_crm_notify_frame_skip(
 int cam_context_handle_crm_flush_req(struct cam_context *ctx,
 	struct cam_req_mgr_flush_request *flush)
 {
-	int rc;
+	int rc = 0;
 
 	if (!ctx->state_machine) {
 		CAM_ERR(CAM_CORE, "Context is not ready");
@@ -276,13 +276,15 @@ int cam_context_handle_crm_flush_req(struct cam_context *ctx,
 	}
 
 	mutex_lock(&ctx->ctx_mutex);
-	if (ctx->state_machine[ctx->state].crm_ops.flush_req) {
-		rc = ctx->state_machine[ctx->state].crm_ops.flush_req(ctx,
-			flush);
-	} else {
-		CAM_ERR(CAM_CORE, "No crm flush req in dev %d, state %d",
-			ctx->dev_hdl, ctx->state);
-		rc = -EPROTO;
+	if (ctx->state != CAM_CTX_FLUSHED) {
+		if (ctx->state_machine[ctx->state].crm_ops.flush_req) {
+			rc = ctx->state_machine[ctx->state].crm_ops.flush_req(ctx,
+				flush);
+		} else {
+			CAM_ERR(CAM_CORE, "No crm flush req in dev %d, state %d, name %s",
+				ctx->dev_hdl, ctx->state, ctx->dev_name);
+			rc = -EPROTO;
+		}
 	}
 	mutex_unlock(&ctx->ctx_mutex);