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

Commit 4697e0e3 authored by Camera Software Integration's avatar Camera Software Integration Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: camera: isp: Add null check for event callback function" into camera-kernel.lnx.1.0

parents 25189c24 2bd721fd
Loading
Loading
Loading
Loading
+29 −4
Original line number Original line Diff line number Diff line
@@ -912,6 +912,10 @@ static int cam_ife_hw_mgr_release_hw_for_ctx(
	struct cam_ife_hw_mgr_res        *hw_mgr_res;
	struct cam_ife_hw_mgr_res        *hw_mgr_res;
	struct cam_ife_hw_mgr_res        *hw_mgr_res_temp;
	struct cam_ife_hw_mgr_res        *hw_mgr_res_temp;


	/* clean up the callback function */
	ife_ctx->common.cb_priv = NULL;
	memset(ife_ctx->common.event_cb, 0, sizeof(ife_ctx->common.event_cb));

	/* ife leaf resource */
	/* ife leaf resource */
	for (i = 0; i < CAM_IFE_HW_OUT_RES_MAX; i++)
	for (i = 0; i < CAM_IFE_HW_OUT_RES_MAX; i++)
		cam_ife_hw_mgr_free_hw_res(&ife_ctx->res_list_ife_out[i]);
		cam_ife_hw_mgr_free_hw_res(&ife_ctx->res_list_ife_out[i]);
@@ -948,10 +952,6 @@ static int cam_ife_hw_mgr_release_hw_for_ctx(
	if (ife_ctx->res_list_ife_in.res_type != CAM_IFE_HW_MGR_RES_UNINIT)
	if (ife_ctx->res_list_ife_in.res_type != CAM_IFE_HW_MGR_RES_UNINIT)
		cam_ife_hw_mgr_free_hw_res(&ife_ctx->res_list_ife_in);
		cam_ife_hw_mgr_free_hw_res(&ife_ctx->res_list_ife_in);


	/* clean up the callback function */
	ife_ctx->common.cb_priv = NULL;
	memset(ife_ctx->common.event_cb, 0, sizeof(ife_ctx->common.event_cb));

	CAM_DBG(CAM_ISP, "release context completed ctx id:%d",
	CAM_DBG(CAM_ISP, "release context completed ctx id:%d",
		ife_ctx->ctx_index);
		ife_ctx->ctx_index);


@@ -6968,6 +6968,11 @@ static int cam_ife_hw_mgr_handle_hw_rup(
	cam_hw_event_cb_func                     ife_hwr_irq_rup_cb;
	cam_hw_event_cb_func                     ife_hwr_irq_rup_cb;
	struct cam_isp_hw_reg_update_event_data  rup_event_data;
	struct cam_isp_hw_reg_update_event_data  rup_event_data;


	if (!ife_hw_mgr_ctx->common.event_cb[CAM_ISP_HW_EVENT_REG_UPDATE]) {
		CAM_ERR(CAM_ISP, "event_cb[HW_EVENT_REG_UPDATE] is null");
		return 0;
	}

	ife_hwr_irq_rup_cb =
	ife_hwr_irq_rup_cb =
		ife_hw_mgr_ctx->common.event_cb[CAM_ISP_HW_EVENT_REG_UPDATE];
		ife_hw_mgr_ctx->common.event_cb[CAM_ISP_HW_EVENT_REG_UPDATE];


@@ -7078,6 +7083,11 @@ static int cam_ife_hw_mgr_handle_hw_epoch(
	struct cam_isp_hw_epoch_event_data    epoch_done_event_data;
	struct cam_isp_hw_epoch_event_data    epoch_done_event_data;
	int                                   rc = 0;
	int                                   rc = 0;


	if (!ife_hw_mgr_ctx->common.event_cb[CAM_ISP_HW_EVENT_EPOCH]) {
		CAM_ERR(CAM_ISP, "event_cb[CAM_ISP_HW_EVENT_EPOCH] is null");
		return 0;
	}

	ife_hw_irq_epoch_cb =
	ife_hw_irq_epoch_cb =
		ife_hw_mgr_ctx->common.event_cb[CAM_ISP_HW_EVENT_EPOCH];
		ife_hw_mgr_ctx->common.event_cb[CAM_ISP_HW_EVENT_EPOCH];


@@ -7127,6 +7137,11 @@ static int cam_ife_hw_mgr_handle_hw_sof(
	struct cam_isp_hw_sof_event_data      sof_done_event_data;
	struct cam_isp_hw_sof_event_data      sof_done_event_data;
	int                                   rc = 0;
	int                                   rc = 0;


	if (!ife_hw_mgr_ctx->common.event_cb[CAM_ISP_HW_EVENT_SOF]) {
		CAM_ERR(CAM_ISP, "event_cb[CAM_ISP_HW_EVENT_SOF] is null");
		return 0;
	}

	memset(&sof_done_event_data, 0, sizeof(sof_done_event_data));
	memset(&sof_done_event_data, 0, sizeof(sof_done_event_data));


	ife_hw_irq_sof_cb =
	ife_hw_irq_sof_cb =
@@ -7202,6 +7217,11 @@ static int cam_ife_hw_mgr_handle_hw_eof(
	struct cam_isp_hw_eof_event_data      eof_done_event_data;
	struct cam_isp_hw_eof_event_data      eof_done_event_data;
	int                                   rc = 0;
	int                                   rc = 0;


	if (!ife_hw_mgr_ctx->common.event_cb[CAM_ISP_HW_EVENT_EOF]) {
		CAM_ERR(CAM_ISP, "event_cb[CAM_ISP_HW_EVENT_EOF] is null");
		return 0;
	}

	ife_hw_irq_eof_cb =
	ife_hw_irq_eof_cb =
		ife_hw_mgr_ctx->common.event_cb[CAM_ISP_HW_EVENT_EOF];
		ife_hw_mgr_ctx->common.event_cb[CAM_ISP_HW_EVENT_EOF];


@@ -7247,6 +7267,11 @@ static int cam_ife_hw_mgr_handle_hw_buf_done(
	struct cam_isp_hw_done_event_data    buf_done_event_data = {0};
	struct cam_isp_hw_done_event_data    buf_done_event_data = {0};
	struct cam_isp_hw_event_info        *event_info = evt_info;
	struct cam_isp_hw_event_info        *event_info = evt_info;


	if (!ife_hw_mgr_ctx->common.event_cb[CAM_ISP_HW_EVENT_DONE]) {
		CAM_ERR(CAM_ISP, "event_cb[CAM_ISP_HW_EVENT_DONE] is null");
		return 0;
	}

	ife_hwr_irq_wm_done_cb =
	ife_hwr_irq_wm_done_cb =
		ife_hw_mgr_ctx->common.event_cb[CAM_ISP_HW_EVENT_DONE];
		ife_hw_mgr_ctx->common.event_cb[CAM_ISP_HW_EVENT_DONE];