瀏覽代碼

Merge "msm: camera: utils: Rate limit error log in case of invalid handles" into camera-kernel.lnx.4.0

Haritha Chintalapati 4 年之前
父節點
當前提交
dd1071a4c6
共有 3 個文件被更改,包括 30 次插入19 次删除
  1. 2 2
      drivers/cam_core/cam_context_utils.c
  2. 18 9
      drivers/cam_core/cam_node.c
  3. 10 8
      drivers/cam_req_mgr/cam_req_mgr_util.c

+ 2 - 2
drivers/cam_core/cam_context_utils.c

@@ -535,8 +535,8 @@ int32_t cam_context_acquire_dev_to_hw(struct cam_context *ctx,
 		cmd->resource_hdl);
 
 	if (cmd->num_resources > CAM_CTX_RES_MAX) {
-		CAM_ERR(CAM_CTXT, "[%s][%d] resource limit exceeded",
-			ctx->dev_name, ctx->ctx_id);
+		CAM_ERR(CAM_CTXT, "[%s][%d] resource[%d] limit exceeded",
+			ctx->dev_name, ctx->ctx_id, cmd->num_resources);
 		rc = -ENOMEM;
 		goto end;
 	}

+ 18 - 9
drivers/cam_core/cam_node.c

@@ -346,31 +346,36 @@ static int __cam_node_handle_flush_dev(struct cam_node *node,
 		return -EINVAL;
 
 	if (flush->dev_handle <= 0) {
-		CAM_ERR(CAM_CORE, "Invalid device handle for context");
+		CAM_ERR_RATE_LIMIT(CAM_CORE,
+			"Invalid device handle for context");
 		return -EINVAL;
 	}
 
 	if (flush->session_handle <= 0) {
-		CAM_ERR(CAM_CORE, "Invalid session handle for context");
+		CAM_ERR_RATE_LIMIT(CAM_CORE,
+			"Invalid session handle for context");
 		return -EINVAL;
 	}
 
 	ctx = (struct cam_context *)cam_get_device_priv(flush->dev_handle);
 	if (!ctx) {
-		CAM_ERR(CAM_CORE, "Can not get context for handle %d",
+		CAM_ERR_RATE_LIMIT(CAM_CORE,
+			"Can not get context for handle %d",
 			flush->dev_handle);
 		return -EINVAL;
 	}
 
 	if (strcmp(node->name, ctx->dev_name)) {
-		CAM_ERR(CAM_CORE, "node name %s dev name:%s not matching",
+		CAM_ERR_RATE_LIMIT(CAM_CORE,
+			"node name %s dev name:%s not matching",
 			node->name, ctx->dev_name);
 		return -EINVAL;
 	}
 
 	rc = cam_context_handle_flush_dev(ctx, flush);
 	if (rc)
-		CAM_ERR(CAM_CORE, "Flush failure for node %s", node->name);
+		CAM_ERR_RATE_LIMIT(CAM_CORE,
+			"Flush failure for node %s", node->name);
 
 	return rc;
 }
@@ -446,25 +451,29 @@ static int __cam_node_handle_dump_dev(struct cam_node *node,
 		return -EINVAL;
 
 	if (dump->dev_handle <= 0) {
-		CAM_ERR(CAM_CORE, "Invalid device handle for context");
+		CAM_ERR_RATE_LIMIT(CAM_CORE,
+			"Invalid device handle for context");
 		return -EINVAL;
 	}
 
 	if (dump->session_handle <= 0) {
-		CAM_ERR(CAM_CORE, "Invalid session handle for context");
+		CAM_ERR_RATE_LIMIT(CAM_CORE,
+			"Invalid session handle for context");
 		return -EINVAL;
 	}
 
 	ctx = (struct cam_context *)cam_get_device_priv(dump->dev_handle);
 	if (!ctx) {
-		CAM_ERR(CAM_CORE, "Can not get context for handle %d",
+		CAM_ERR_RATE_LIMIT(CAM_CORE,
+			"Can not get context for handle %d",
 			dump->dev_handle);
 		return -EINVAL;
 	}
 
 	rc = cam_context_handle_dump_dev(ctx, dump);
 	if (rc)
-		CAM_ERR(CAM_CORE, "Dump failure for node %s", node->name);
+		CAM_ERR_RATE_LIMIT(CAM_CORE,
+			"Dump failure for node %s", node->name);
 
 	return rc;
 }

+ 10 - 8
drivers/cam_req_mgr/cam_req_mgr_util.c

@@ -223,23 +223,25 @@ void *cam_get_device_priv(int32_t dev_hdl)
 
 	idx = CAM_REQ_MGR_GET_HDL_IDX(dev_hdl);
 	if (idx >= CAM_REQ_MGR_MAX_HANDLES_V2) {
-		CAM_ERR_RATE_LIMIT(CAM_CRM, "Invalid idx");
+		CAM_ERR_RATE_LIMIT(CAM_CRM, "Invalid idx:%d", idx);
 		goto device_priv_fail;
 	}
 
-	if (hdl_tbl->hdl[idx].state != HDL_ACTIVE) {
-		CAM_ERR_RATE_LIMIT(CAM_CRM, "Invalid state");
+	if (hdl_tbl->hdl[idx].hdl_value != dev_hdl) {
+		CAM_ERR_RATE_LIMIT(CAM_CRM, "Invalid hdl [%d] [%d]",
+			dev_hdl, hdl_tbl->hdl[idx].hdl_value);
 		goto device_priv_fail;
 	}
 
-	type = CAM_REQ_MGR_GET_HDL_TYPE(dev_hdl);
-	if (HDL_TYPE_DEV != type && HDL_TYPE_SESSION != type) {
-		CAM_ERR_RATE_LIMIT(CAM_CRM, "Invalid type");
+	if (hdl_tbl->hdl[idx].state != HDL_ACTIVE) {
+		CAM_ERR_RATE_LIMIT(CAM_CRM, "Invalid state:%d",
+			hdl_tbl->hdl[idx].state);
 		goto device_priv_fail;
 	}
 
-	if (hdl_tbl->hdl[idx].hdl_value != dev_hdl) {
-		CAM_ERR_RATE_LIMIT(CAM_CRM, "Invalid hdl");
+	type = CAM_REQ_MGR_GET_HDL_TYPE(dev_hdl);
+	if (HDL_TYPE_DEV != type && HDL_TYPE_SESSION != type) {
+		CAM_ERR_RATE_LIMIT(CAM_CRM, "Invalid type:%d", type);
 		goto device_priv_fail;
 	}