Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 35868804 authored by Ravikishore Pampana's avatar Ravikishore Pampana
Browse files

msm: camera: isp: Return error if cdm acquire fails



Return the proper rc value if cam_cdm_acquire fails. Put the hw
context back if cdm hw acquire fails.  Before this change, it was
returning rc value as zero causing the application to resend the
hardware release again.
if cam_ife_mgr_acquire_hw fails, release the cdm resource before
return.

Change-Id: Ia002076c53e5a0b7767d962859610b3ad9bd11a1
Signed-off-by: default avatarRavikishore Pampana <rpampana@codeaurora.org>
parent ee40106f
Loading
Loading
Loading
Loading
+11 −8
Original line number Diff line number Diff line
@@ -1271,15 +1271,16 @@ static int cam_ife_mgr_acquire_hw(void *hw_mgr_priv,

	cdm_acquire.id = CAM_CDM_VIRTUAL;
	cdm_acquire.cam_cdm_callback = cam_ife_cam_cdm_callback;
	if (!cam_cdm_acquire(&cdm_acquire)) {
	rc = cam_cdm_acquire(&cdm_acquire);
	if (rc) {
		CAM_ERR(CAM_ISP, "Failed to acquire the CDM HW");
		goto free_ctx;
	}

	CAM_DBG(CAM_ISP, "Successfully acquired the CDM HW hdl=%x",
		cdm_acquire.handle);
	ife_ctx->cdm_handle = cdm_acquire.handle;
	ife_ctx->cdm_ops = cdm_acquire.ops;
	} else {
		CAM_ERR(CAM_ISP, "Failed to acquire the CDM HW");
		goto err;
	}

	isp_resource = (struct cam_isp_resource *)acquire_args->acquire_info;

@@ -1325,7 +1326,7 @@ static int cam_ife_mgr_acquire_hw(void *hw_mgr_priv,
	rc = cam_ife_mgr_process_base_info(ife_ctx);
	if (rc) {
		CAM_ERR(CAM_ISP, "Process base info failed");
		return -EINVAL;
		goto free_res;
	}

	acquire_args->ctxt_to_hw_map = ife_ctx;
@@ -1338,6 +1339,8 @@ static int cam_ife_mgr_acquire_hw(void *hw_mgr_priv,
	return 0;
free_res:
	cam_ife_hw_mgr_release_hw_for_ctx(ife_ctx);
	cam_cdm_release(ife_ctx->cdm_handle);
free_ctx:
	cam_ife_hw_mgr_put_ctx(&ife_hw_mgr->free_ctx_list, &ife_ctx);
err:
	CAM_DBG(CAM_ISP, "Exit...(rc=%d)", rc);