فهرست منبع

video: driver: Remove inst check in video driver

Remove inst check from all the functions in video driver.
Inst check is present in most of the functions in video
driver which is not required.
Keep check only at root level functions and remove
from rest all of the functions.

Change-Id: Ib310cd3df5e8612a9fc3a5aa654dff4203a12906
Signed-off-by: Vedang Nagar <[email protected]>
Vedang Nagar 2 سال پیش
والد
کامیت
e2663ce820
32فایلهای تغییر یافته به همراه207 افزوده شده و 2223 حذف شده
  1. 0 400
      driver/platform/common/src/msm_vidc_platform.c
  2. 0 35
      driver/platform/common/src/msm_vidc_platform_ext.c
  3. 0 4
      driver/platform/pineapple/src/msm_vidc_pineapple.c
  4. 0 4
      driver/platform/pineapple/src/pineapple.c
  5. 0 79
      driver/variant/iris2/src/msm_vidc_buffer_iris2.c
  6. 0 20
      driver/variant/iris2/src/msm_vidc_iris2.c
  7. 0 9
      driver/variant/iris2/src/msm_vidc_power_iris2.c
  8. 0 94
      driver/variant/iris3/src/msm_vidc_buffer_iris3.c
  9. 0 20
      driver/variant/iris3/src/msm_vidc_iris3.c
  10. 0 14
      driver/variant/iris3/src/msm_vidc_power_iris3.c
  11. 0 94
      driver/variant/iris33/src/msm_vidc_buffer_iris33.c
  12. 0 20
      driver/variant/iris33/src/msm_vidc_iris33.c
  13. 0 18
      driver/variant/iris33/src/msm_vidc_power_iris33.c
  14. 32 32
      driver/vidc/inc/msm_vidc.h
  15. 8 5
      driver/vidc/inc/msm_vidc_debug.h
  16. 1 30
      driver/vidc/src/hfi_packet.c
  17. 2 145
      driver/vidc/src/msm_vdec.c
  18. 1 139
      driver/vidc/src/msm_venc.c
  19. 37 216
      driver/vidc/src/msm_vidc.c
  20. 0 43
      driver/vidc/src/msm_vidc_buffer.c
  21. 0 48
      driver/vidc/src/msm_vidc_control.c
  22. 26 44
      driver/vidc/src/msm_vidc_debug.c
  23. 4 411
      driver/vidc/src/msm_vidc_driver.c
  24. 0 34
      driver/vidc/src/msm_vidc_fence.c
  25. 5 20
      driver/vidc/src/msm_vidc_memory.c
  26. 0 38
      driver/vidc/src/msm_vidc_power.c
  27. 0 45
      driver/vidc/src/msm_vidc_state.c
  28. 0 29
      driver/vidc/src/msm_vidc_synx.c
  29. 49 27
      driver/vidc/src/msm_vidc_v4l2.c
  30. 23 16
      driver/vidc/src/msm_vidc_vb2.c
  31. 19 31
      driver/vidc/src/venus_hfi.c
  32. 0 59
      driver/vidc/src/venus_hfi_response.c

+ 0 - 400
driver/platform/common/src/msm_vidc_platform.c

@@ -515,11 +515,6 @@ int msm_vidc_update_cap_value(struct msm_vidc_inst *inst, u32 cap_id,
 {
 	int prev_value = 0;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	prev_value = inst->capabilities[cap_id].value;
 
 	if (is_meta_cap(inst, cap_id)) {
@@ -810,11 +805,6 @@ int msm_vidc_adjust_entropy_mode(void *instance, struct v4l2_ctrl *ctrl)
 	struct msm_vidc_inst *inst = (struct msm_vidc_inst *) instance;
 	s32 profile = -1;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	/* ctrl is always NULL in streamon case */
 	adjusted_value = ctrl ? ctrl->val :
 		inst->capabilities[ENTROPY_MODE].value;
@@ -846,11 +836,6 @@ int msm_vidc_adjust_bitrate_mode(void *instance, struct v4l2_ctrl *ctrl)
 	int lossless, frame_rc, bitrate_mode, frame_skip;
 	u32 hfi_value = 0;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	bitrate_mode = inst->capabilities[BITRATE_MODE].value;
 	lossless = inst->capabilities[LOSSLESS].value;
 	frame_rc = inst->capabilities[FRAME_RC_ENABLE].value;
@@ -892,11 +877,6 @@ int msm_vidc_adjust_profile(void *instance, struct v4l2_ctrl *ctrl)
 	struct msm_vidc_inst *inst = (struct msm_vidc_inst *) instance;
 	s32 pix_fmt = -1;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	adjusted_value = ctrl ? ctrl->val : inst->capabilities[PROFILE].value;
 
 	/* PIX_FMTS dependency is common across all chipsets.
@@ -935,11 +915,6 @@ int msm_vidc_adjust_ltr_count(void *instance, struct v4l2_ctrl *ctrl)
 	s32 layer_type = -1, enh_layer_count = -1;
 	u32 num_ref_frames = 0, max_exceeding_ref_frames = 0;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	adjusted_value = ctrl ? ctrl->val : inst->capabilities[LTR_COUNT].value;
 
 	if (msm_vidc_get_parent_value(inst, LTR_COUNT, BITRATE_MODE,
@@ -1011,11 +986,6 @@ int msm_vidc_adjust_use_ltr(void *instance, struct v4l2_ctrl *ctrl)
 	s32 adjusted_value, ltr_count;
 	struct msm_vidc_inst *inst = (struct msm_vidc_inst *) instance;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	adjusted_value = ctrl ? ctrl->val : inst->capabilities[USE_LTR].value;
 
 	/*
@@ -1051,11 +1021,6 @@ int msm_vidc_adjust_mark_ltr(void *instance, struct v4l2_ctrl *ctrl)
 	s32 adjusted_value, ltr_count;
 	struct msm_vidc_inst *inst = (struct msm_vidc_inst *) instance;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	adjusted_value = ctrl ? ctrl->val : inst->capabilities[MARK_LTR].value;
 
 	/*
@@ -1088,11 +1053,6 @@ int msm_vidc_adjust_delta_based_rc(void *instance, struct v4l2_ctrl *ctrl)
 	struct msm_vidc_inst *inst = (struct msm_vidc_inst *) instance;
 	s32 rc_type = -1;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	adjusted_value = ctrl ? ctrl->val :
 		inst->capabilities[TIME_DELTA_BASED_RC].value;
 
@@ -1117,11 +1077,6 @@ int msm_vidc_adjust_output_order(void *instance, struct v4l2_ctrl *ctrl)
 	s32 tn_mode = -1, display_delay = -1, display_delay_enable = -1;
 	u32 adjusted_value;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	adjusted_value = ctrl ? ctrl->val :
 		inst->capabilities[OUTPUT_ORDER].value;
 
@@ -1155,11 +1110,6 @@ int msm_vidc_adjust_input_buf_host_max_count(void *instance, struct v4l2_ctrl *c
 
 	u32 adjusted_value;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	adjusted_value = ctrl ? ctrl->val :
 		inst->capabilities[INPUT_BUF_HOST_MAX_COUNT].value;
 
@@ -1178,11 +1128,6 @@ int msm_vidc_adjust_output_buf_host_max_count(void *instance, struct v4l2_ctrl *
 
 	u32 adjusted_value;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	adjusted_value = ctrl ? ctrl->val :
 		inst->capabilities[OUTPUT_BUF_HOST_MAX_COUNT].value;
 
@@ -1202,11 +1147,6 @@ int msm_vidc_adjust_transform_8x8(void *instance, struct v4l2_ctrl *ctrl)
 	struct msm_vidc_inst *inst = (struct msm_vidc_inst *) instance;
 	s32 profile = -1;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	adjusted_value = ctrl ? ctrl->val :
 		inst->capabilities[TRANSFORM_8X8].value;
 
@@ -1237,11 +1177,6 @@ int msm_vidc_adjust_chroma_qp_index_offset(void *instance,
 	s32 adjusted_value;
 	struct msm_vidc_inst *inst = (struct msm_vidc_inst *) instance;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	adjusted_value = ctrl ? ctrl->val :
 		inst->capabilities[CHROMA_QP_INDEX_OFFSET].value;
 
@@ -1306,11 +1241,6 @@ int msm_vidc_adjust_slice_count(void *instance, struct v4l2_ctrl *ctrl)
 	u32 update_cap, max_avg_slicesize, output_width, output_height;
 	u32 min_width, min_height, max_width, max_height, fps;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	slice_mode = ctrl ? ctrl->val :
 		inst->capabilities[SLICE_MODE].value;
 
@@ -1437,11 +1367,6 @@ static int msm_vidc_adjust_static_layer_count_and_type(struct msm_vidc_inst *ins
 {
 	bool hb_requested = false;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	if (!layer_count) {
 		i_vpr_h(inst, "client not enabled layer encoding\n");
 		goto exit;
@@ -1523,11 +1448,6 @@ int msm_vidc_adjust_layer_count(void *instance, struct v4l2_ctrl *ctrl)
 	s32 client_layer_count;
 	struct msm_vidc_inst *inst = (struct msm_vidc_inst *) instance;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	client_layer_count = ctrl ? ctrl->val :
 		inst->capabilities[ENH_LAYER_COUNT].value;
 
@@ -1572,11 +1492,6 @@ int msm_vidc_adjust_gop_size(void *instance, struct v4l2_ctrl *ctrl)
 	s32 adjusted_value, enh_layer_count = -1;
 	u32 min_gop_size, num_subgops;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	adjusted_value = ctrl ? ctrl->val : inst->capabilities[GOP_SIZE].value;
 
 	if (msm_vidc_get_parent_value(inst, GOP_SIZE,
@@ -1611,11 +1526,6 @@ int msm_vidc_adjust_b_frame(void *instance, struct v4l2_ctrl *ctrl)
 	s32 adjusted_value, enh_layer_count = -1;
 	const u32 max_bframe_size = 7;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	adjusted_value = ctrl ? ctrl->val : inst->capabilities[B_FRAME].value;
 
 	if (msm_vidc_get_parent_value(inst, B_FRAME,
@@ -1647,11 +1557,6 @@ int msm_vidc_adjust_bitrate(void *instance, struct v4l2_ctrl *ctrl)
 	u32 layer_br_caps[6] = {L0_BR, L1_BR, L2_BR, L3_BR, L4_BR, L5_BR};
 	u32 max_bitrate = 0;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	/* ignore layer bitrate when total bitrate is set */
 	if (inst->capabilities[BIT_RATE].flags & CAP_FLAG_CLIENT_SET) {
 		/*
@@ -1738,11 +1643,6 @@ int msm_vidc_adjust_layer_bitrate(void *instance, struct v4l2_ctrl *ctrl)
 	u32 old_br = 0, new_br = 0, exceeded_br = 0;
 	s32 max_bitrate;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	if (!ctrl)
 		return 0;
 
@@ -1813,11 +1713,6 @@ int msm_vidc_adjust_peak_bitrate(void *instance, struct v4l2_ctrl *ctrl)
 	struct msm_vidc_inst *inst = (struct msm_vidc_inst *) instance;
 	s32 rc_type = -1, bitrate = -1;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	adjusted_value = ctrl ? ctrl->val :
 		inst->capabilities[PEAK_BITRATE].value;
 
@@ -1888,11 +1783,6 @@ int msm_vidc_adjust_hevc_min_qp(void *instance, struct v4l2_ctrl *ctrl)
 
 	struct msm_vidc_inst *inst = (struct msm_vidc_inst *) instance;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	if (ctrl)
 		msm_vidc_update_cap_value(inst, MIN_FRAME_QP,
 			ctrl->val, __func__);
@@ -1908,11 +1798,6 @@ int msm_vidc_adjust_hevc_max_qp(void *instance, struct v4l2_ctrl *ctrl)
 
 	struct msm_vidc_inst *inst = (struct msm_vidc_inst *) instance;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	if (ctrl)
 		msm_vidc_update_cap_value(inst, MAX_FRAME_QP,
 			ctrl->val, __func__);
@@ -1928,11 +1813,6 @@ int msm_vidc_adjust_hevc_i_frame_qp(void *instance, struct v4l2_ctrl *ctrl)
 
 	struct msm_vidc_inst *inst = (struct msm_vidc_inst *) instance;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	if (ctrl)
 		msm_vidc_update_cap_value(inst, I_FRAME_QP,
 			ctrl->val, __func__);
@@ -1950,11 +1830,6 @@ int msm_vidc_adjust_hevc_p_frame_qp(void *instance, struct v4l2_ctrl *ctrl)
 
 	struct msm_vidc_inst *inst = (struct msm_vidc_inst *) instance;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	if (ctrl)
 		msm_vidc_update_cap_value(inst, P_FRAME_QP,
 			ctrl->val, __func__);
@@ -1972,11 +1847,6 @@ int msm_vidc_adjust_hevc_b_frame_qp(void *instance, struct v4l2_ctrl *ctrl)
 
 	struct msm_vidc_inst *inst = (struct msm_vidc_inst *) instance;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	if (ctrl)
 		msm_vidc_update_cap_value(inst, B_FRAME_QP,
 			ctrl->val, __func__);
@@ -1995,11 +1865,6 @@ int msm_vidc_adjust_blur_type(void *instance, struct v4l2_ctrl *ctrl)
 	s32 rc_type = -1, roi_enable = -1;
 	s32 pix_fmts = -1, min_quality = -1;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	adjusted_value = ctrl ? ctrl->val :
 		inst->capabilities[BLUR_TYPES].value;
 
@@ -2058,11 +1923,6 @@ int msm_vidc_adjust_all_intra(void *instance, struct v4l2_ctrl *ctrl)
 	s32 gop_size = -1, bframe = -1;
 	u32 width, height, fps, mbps, max_mbps;
 
-	if (!inst || !inst->core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	adjusted_value = inst->capabilities[ALL_INTRA].value;
 
 	if (msm_vidc_get_parent_value(inst, ALL_INTRA, GOP_SIZE,
@@ -2101,11 +1961,6 @@ int msm_vidc_adjust_blur_resolution(void *instance, struct v4l2_ctrl *ctrl)
 	struct msm_vidc_inst *inst = (struct msm_vidc_inst *) instance;
 	s32 blur_type = -1;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	adjusted_value = ctrl ? ctrl->val :
 		inst->capabilities[BLUR_RESOLUTION].value;
 
@@ -2129,11 +1984,6 @@ int msm_vidc_adjust_brs(void *instance, struct v4l2_ctrl *ctrl)
 	s32 rc_type = -1, layer_enabled = -1, layer_type = -1;
 	bool hp_requested = false;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	adjusted_value = ctrl ? ctrl->val :
 		inst->capabilities[CONTENT_ADAPTIVE_CODING].value;
 
@@ -2188,11 +2038,6 @@ int msm_vidc_adjust_bitrate_boost(void *instance, struct v4l2_ctrl *ctrl)
 	s32 min_quality = -1, rc_type = -1;
 	u32 max_bitrate = 0, bitrate = 0;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	adjusted_value = ctrl ? ctrl->val :
 		inst->capabilities[BITRATE_BOOST].value;
 
@@ -2245,11 +2090,6 @@ int msm_vidc_adjust_min_quality(void *instance, struct v4l2_ctrl *ctrl)
 	u32 width, height, frame_rate;
 	struct v4l2_format *f;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	adjusted_value = ctrl ? ctrl->val : inst->capabilities[MIN_QUALITY].value;
 
 	/*
@@ -2358,11 +2198,6 @@ int msm_vidc_adjust_preprocess(void *instance, struct v4l2_ctrl *ctrl)
 	u32 width, height, frame_rate, operating_rate, max_fps;
 	struct v4l2_format *f;
 
-	if (!inst || !inst->core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	adjusted_value = inst->capabilities[REQUEST_PREPROCESS].value;
 
 	width = inst->crop.width;
@@ -2413,11 +2248,6 @@ int msm_vidc_adjust_enc_lowlatency_mode(void *instance, struct v4l2_ctrl *ctrl)
 	struct msm_vidc_inst *inst = (struct msm_vidc_inst *) instance;
 	s32 rc_type = -1;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	adjusted_value = ctrl ? ctrl->val :
 		inst->capabilities[LOWLATENCY_MODE].value;
 
@@ -2442,11 +2272,6 @@ int msm_vidc_adjust_dec_lowlatency_mode(void *instance, struct v4l2_ctrl *ctrl)
 	struct msm_vidc_inst *inst = (struct msm_vidc_inst *) instance;
 	s32 outbuf_fence = MSM_VIDC_META_DISABLE;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	adjusted_value = ctrl ? ctrl->val :
 		inst->capabilities[LOWLATENCY_MODE].value;
 
@@ -2472,10 +2297,6 @@ int msm_vidc_adjust_session_priority(void *instance, struct v4l2_ctrl *ctrl)
 
 	struct msm_vidc_inst *inst = (struct msm_vidc_inst *)instance;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
 	/*
 	 * Priority handling
 	 * Client will set 0 (realtime), (1 to 4) (non-realtime)
@@ -2510,11 +2331,6 @@ int msm_vidc_adjust_roi_info(void *instance, struct v4l2_ctrl *ctrl)
 	struct msm_vidc_inst *inst = (struct msm_vidc_inst *) instance;
 	s32 rc_type = -1, pix_fmt = -1;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	adjusted_value = ctrl ? ctrl->val : inst->capabilities[META_ROI_INFO].value;
 
 	if (msm_vidc_get_parent_value(inst, META_ROI_INFO, BITRATE_MODE,
@@ -2542,11 +2358,6 @@ int msm_vidc_adjust_dec_outbuf_fence(void *instance, struct v4l2_ctrl *ctrl)
 	u32 adjusted_value = 0;
 	s32 picture_order = -1;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	adjusted_value = ctrl ? ctrl->val : inst->capabilities[META_OUTBUF_FENCE].value;
 
 	if (msm_vidc_get_parent_value(inst, META_OUTBUF_FENCE, OUTPUT_ORDER,
@@ -2572,10 +2383,6 @@ int msm_vidc_adjust_dec_outbuf_fence_type(void *instance, struct v4l2_ctrl *ctrl
 	struct msm_vidc_inst *inst = (struct msm_vidc_inst *) instance;
 	struct msm_vidc_core *core;
 
-	if (!inst || !inst->core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
 	capability = inst->capabilities;
 	core = inst->core;
 
@@ -2608,10 +2415,6 @@ int msm_vidc_adjust_dec_outbuf_fence_direction(void *instance, struct v4l2_ctrl
 	struct msm_vidc_inst *inst = (struct msm_vidc_inst *) instance;
 	struct msm_vidc_core *core;
 
-	if (!inst || !inst->core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
 	capability = inst->capabilities;
 	core = inst->core;
 
@@ -2642,11 +2445,6 @@ int msm_vidc_adjust_dec_slice_mode(void *instance, struct v4l2_ctrl *ctrl)
 	s32 picture_order = -1;
 	s32 outbuf_fence = 0;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	adjusted_value = ctrl ? ctrl->val : inst->capabilities[SLICE_DECODE].value;
 
 	if (msm_vidc_get_parent_value(inst, SLICE_DECODE, LOWLATENCY_MODE,
@@ -2673,11 +2471,6 @@ int msm_vidc_adjust_eva_stats(void *instance, struct v4l2_ctrl *ctrl)
 	struct msm_vidc_inst *inst = (struct msm_vidc_inst *) instance;
 	s32 rc_type = -1;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	adjusted_value = ctrl ? ctrl->val : inst->capabilities[META_EVA_STATS].value;
 
 	if (msm_vidc_get_parent_value(inst, META_EVA_STATS, BITRATE_MODE,
@@ -2702,11 +2495,6 @@ int msm_vidc_adjust_sei_mastering_disp(void *instance, struct v4l2_ctrl *ctrl)
 	struct msm_vidc_inst *inst = (struct msm_vidc_inst *) instance;
 	s32 profile = -1;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	adjusted_value = ctrl ? ctrl->val : inst->capabilities[META_SEI_MASTERING_DISP].value;
 
 	if (msm_vidc_get_parent_value(inst, META_SEI_MASTERING_DISP, PROFILE,
@@ -2738,11 +2526,6 @@ int msm_vidc_adjust_sei_cll(void *instance, struct v4l2_ctrl *ctrl)
 	struct msm_vidc_inst *inst = (struct msm_vidc_inst *) instance;
 	s32 profile = -1;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	adjusted_value = ctrl ? ctrl->val : inst->capabilities[META_SEI_CLL].value;
 
 	if (msm_vidc_get_parent_value(inst, META_SEI_CLL, PROFILE,
@@ -2773,11 +2556,6 @@ int msm_vidc_adjust_hdr10plus(void *instance, struct v4l2_ctrl *ctrl)
 	struct msm_vidc_inst *inst = (struct msm_vidc_inst *) instance;
 	s32 profile = -1;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	adjusted_value = ctrl ? ctrl->val : inst->capabilities[META_HDR10PLUS].value;
 
 	if (msm_vidc_get_parent_value(inst, META_HDR10PLUS, PROFILE,
@@ -2810,11 +2588,6 @@ int msm_vidc_adjust_transcoding_stats(void *instance, struct v4l2_ctrl *ctrl)
 	u32 width, height, fps;
 	struct v4l2_format *f;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	adjusted_value = ctrl ? ctrl->val :
 		inst->capabilities[META_TRANSCODING_STAT_INFO].value;
 
@@ -2872,12 +2645,6 @@ int msm_vidc_set_header_mode(void *instance,
 	int header_mode, prepend_sps_pps;
 	u32 hfi_value = 0;
 
-
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	header_mode = inst->capabilities[cap_id].value;
 	prepend_sps_pps = inst->capabilities[PREPEND_SPSPPS_TO_IDR].value;
 
@@ -2908,12 +2675,6 @@ int msm_vidc_set_deblock_mode(void *instance,
 	s32 alpha = 0, beta = 0;
 	u32 lf_mode, hfi_value = 0, lf_offset = 6;
 
-
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	rc = msm_vidc_v4l2_to_hfi_enum(inst, LF_MODE, &lf_mode);
 	if (rc)
 		return -EINVAL;
@@ -2938,11 +2699,6 @@ int msm_vidc_set_constant_quality(void *instance,
 	u32 hfi_value = 0;
 	s32 rc_type = -1;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	if (msm_vidc_get_parent_value(inst, cap_id,
 		BITRATE_MODE, &rc_type, __func__))
 		return -EINVAL;
@@ -2968,11 +2724,6 @@ int msm_vidc_set_vbr_related_properties(void *instance,
 	u32 hfi_value = 0;
 	s32 rc_type = -1;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	if (msm_vidc_get_parent_value(inst, cap_id,
 		BITRATE_MODE, &rc_type, __func__))
 		return -EINVAL;
@@ -2998,11 +2749,6 @@ int msm_vidc_set_cbr_related_properties(void *instance,
 	u32 hfi_value = 0;
 	s32 rc_type = -1;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	if (msm_vidc_get_parent_value(inst, cap_id,
 		BITRATE_MODE, &rc_type, __func__))
 		return -EINVAL;
@@ -3028,11 +2774,6 @@ int msm_vidc_set_use_and_mark_ltr(void *instance,
 	struct msm_vidc_inst *inst = (struct msm_vidc_inst *)instance;
 	u32 hfi_value = 0;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	if (!inst->capabilities[LTR_COUNT].value ||
 		(inst->capabilities[cap_id].value ==
 			INVALID_DEFAULT_MARK_OR_USE_LTR)) {
@@ -3065,11 +2806,6 @@ int msm_vidc_set_min_qp(void *instance,
 	u32 i_qp_enable = 0, p_qp_enable = 0, b_qp_enable = 0;
 	u32 client_qp_enable = 0, hfi_value = 0, offset = 0;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	if (inst->capabilities[MIN_FRAME_QP].flags & CAP_FLAG_CLIENT_SET)
 		min_qp_enable = 1;
 
@@ -3129,11 +2865,6 @@ int msm_vidc_set_max_qp(void *instance,
 	u32 i_qp_enable = 0, p_qp_enable = 0, b_qp_enable = 0;
 	u32 client_qp_enable = 0, hfi_value = 0, offset = 0;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	if (inst->capabilities[MAX_FRAME_QP].flags & CAP_FLAG_CLIENT_SET)
 		max_qp_enable = 1;
 
@@ -3193,11 +2924,6 @@ int msm_vidc_set_frame_qp(void *instance,
 	u32 i_qp_enable = 0, p_qp_enable = 0, b_qp_enable = 0;
 	u32 client_qp_enable = 0, hfi_value = 0, offset = 0;
 	s32 rc_type = -1;
-
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
 	capab = inst->capabilities;
 
 	if (msm_vidc_get_parent_value(inst, cap_id,
@@ -3260,11 +2986,6 @@ int msm_vidc_set_req_sync_frame(void *instance,
 	s32 prepend_spspps;
 	u32 hfi_value = 0;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	prepend_spspps = inst->capabilities[PREPEND_SPSPPS_TO_IDR].value;
 	if (prepend_spspps)
 		hfi_value = HFI_SYNC_FRAME_REQUEST_WITH_PREFIX_SEQ_HDR;
@@ -3287,11 +3008,6 @@ int msm_vidc_set_chroma_qp_index_offset(void *instance,
 	u32 hfi_value = 0, chroma_qp_offset_mode = 0, chroma_qp = 0;
 	u32 offset = 12;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	if (inst->capabilities[cap_id].flags & CAP_FLAG_CLIENT_SET)
 		chroma_qp_offset_mode = HFI_FIXED_CHROMAQP_OFFSET;
 	else
@@ -3316,11 +3032,6 @@ int msm_vidc_set_slice_count(void *instance,
 	s32 slice_mode = -1;
 	u32 hfi_value = 0, set_cap_id = 0;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	slice_mode = inst->capabilities[SLICE_MODE].value;
 
 	if (slice_mode == V4L2_MPEG_VIDEO_MULTI_SLICE_MODE_SINGLE) {
@@ -3353,11 +3064,6 @@ int msm_vidc_set_nal_length(void *instance,
 	struct msm_vidc_inst *inst = (struct msm_vidc_inst *)instance;
 	u32 hfi_value = HFI_NAL_LENGTH_STARTCODES;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	if (!inst->capabilities[WITHOUT_STARTCODE].value) {
 		hfi_value = HFI_NAL_LENGTH_STARTCODES;
 	} else {
@@ -3381,11 +3087,6 @@ int msm_vidc_set_layer_count_and_type(void *instance,
 	struct msm_vidc_inst *inst = (struct msm_vidc_inst *)instance;
 	u32 hfi_layer_count, hfi_layer_type = 0;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	if (!inst->bufq[OUTPUT_PORT].vb2q->streaming) {
 		/* set layer type */
 		hfi_layer_type = inst->hfi_layer_type;
@@ -3425,11 +3126,6 @@ int msm_vidc_set_gop_size(void *instance,
 	struct msm_vidc_inst *inst = (struct msm_vidc_inst *)instance;
 	u32 hfi_value;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	if (inst->bufq[OUTPUT_PORT].vb2q->streaming) {
 		if (inst->hfi_layer_type == HFI_HIER_B) {
 			i_vpr_l(inst,
@@ -3456,11 +3152,6 @@ int msm_vidc_set_bitrate(void *instance,
 	struct msm_vidc_inst *inst = (struct msm_vidc_inst *)instance;
 	u32 hfi_value = 0;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	/* set Total Bitrate */
 	if (inst->capabilities[BIT_RATE].flags & CAP_FLAG_CLIENT_SET)
 		goto set_total_bitrate;
@@ -3491,11 +3182,6 @@ int msm_vidc_set_layer_bitrate(void *instance,
 	struct msm_vidc_inst *inst = (struct msm_vidc_inst *)instance;
 	u32 hfi_value = 0;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	if (!inst->bufq[OUTPUT_PORT].vb2q->streaming)
 		return 0;
 
@@ -3539,11 +3225,6 @@ int msm_vidc_set_session_priority(void *instance,
 	u32 hfi_value = 0;
 	struct msm_vidc_inst *inst = (struct msm_vidc_inst *)instance;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	hfi_value = inst->capabilities[cap_id].value;
 	if (!is_critical_priority_session(inst))
 		hfi_value = inst->capabilities[cap_id].value +
@@ -3564,11 +3245,6 @@ int msm_vidc_set_flip(void *instance,
 	u32 hflip, vflip, hfi_value = HFI_DISABLE_FLIP;
 	struct msm_vidc_inst *inst = (struct msm_vidc_inst *)instance;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	hflip = inst->capabilities[HFLIP].value;
 	vflip = inst->capabilities[VFLIP].value;
 
@@ -3602,11 +3278,6 @@ int msm_vidc_set_preprocess(void *instance,
 	struct msm_vidc_inst *inst = (struct msm_vidc_inst *)instance;
 	u32 hfi_value;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	rc = msm_vidc_packetize_control(inst, cap_id, HFI_PAYLOAD_U32_ENUM,
 		&hfi_value, sizeof(u32), __func__);
 	if (rc)
@@ -3622,11 +3293,6 @@ int msm_vidc_set_rotation(void *instance,
 	struct msm_vidc_inst *inst = (struct msm_vidc_inst *)instance;
 	u32 hfi_value;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	rc = msm_vidc_v4l2_to_hfi_enum(inst, cap_id, &hfi_value);
 	if (rc)
 		return -EINVAL;
@@ -3647,11 +3313,6 @@ int msm_vidc_set_blur_resolution(void *instance,
 	s32 blur_type = -1;
 	u32 hfi_value, blur_width, blur_height;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	if (msm_vidc_get_parent_value(inst, cap_id,
 		BLUR_TYPES, &blur_type, __func__))
 		return -EINVAL;
@@ -3726,10 +3387,6 @@ int msm_vidc_set_csc_custom_matrix(void *instance,
 	s32 csc_bias_payload[MAX_BIAS_COEFFS + 2];
 	s32 csc_limit_payload[MAX_LIMIT_COEFFS + 2];
 
-	if (!inst || !inst->core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
 	core = inst->core;
 	if (!core->platform) {
 		d_vpr_e("%s: invalid core platform\n", __func__);
@@ -3816,11 +3473,6 @@ int msm_vidc_set_reserve_duration(void *instance,
 	u32 hfi_value = 0;
 	struct msm_vidc_inst *inst = (struct msm_vidc_inst *)instance;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	/* reserve hardware only when input port is streaming*/
 	if (!inst->bufq[INPUT_PORT].vb2q->streaming)
 		return 0;
@@ -3851,11 +3503,6 @@ int msm_vidc_set_level(void *instance,
 	struct msm_vidc_inst *inst = (struct msm_vidc_inst *)instance;
 	u32 hfi_value = 0;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	hfi_value = inst->capabilities[cap_id].value;
 	if (!(inst->capabilities[cap_id].flags & CAP_FLAG_CLIENT_SET))
 		hfi_value = HFI_LEVEL_NONE;
@@ -3875,11 +3522,6 @@ int msm_vidc_set_q16(void *instance,
 	struct msm_vidc_inst *inst = (struct msm_vidc_inst *)instance;
 	u32 hfi_value = 0;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	hfi_value = inst->capabilities[cap_id].value;
 
 	rc = msm_vidc_packetize_control(inst, cap_id, HFI_PAYLOAD_Q16,
@@ -3897,11 +3539,6 @@ int msm_vidc_set_u32(void *instance,
 	struct msm_vidc_inst *inst = (struct msm_vidc_inst *)instance;
 	u32 hfi_value;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	if (inst->capabilities[cap_id].flags & CAP_FLAG_MENU) {
 		rc = msm_vidc_v4l2_menu_to_hfi(inst, cap_id, &hfi_value);
 		if (rc)
@@ -3925,11 +3562,6 @@ int msm_vidc_set_u32_packed(void *instance,
 	struct msm_vidc_inst *inst = (struct msm_vidc_inst *)instance;
 	u32 hfi_value;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	if (inst->capabilities[cap_id].flags & CAP_FLAG_MENU) {
 		rc = msm_vidc_v4l2_menu_to_hfi(inst, cap_id, &hfi_value);
 		if (rc)
@@ -3953,11 +3585,6 @@ int msm_vidc_set_u32_enum(void *instance,
 	struct msm_vidc_inst *inst = (struct msm_vidc_inst *)instance;
 	u32 hfi_value;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	rc = msm_vidc_v4l2_to_hfi_enum(inst, cap_id, &hfi_value);
 	if (rc)
 		return -EINVAL;
@@ -3977,10 +3604,6 @@ int msm_vidc_set_s32(void *instance,
 	struct msm_vidc_inst *inst = (struct msm_vidc_inst *)instance;
 	s32 hfi_value = 0;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
 	hfi_value = inst->capabilities[cap_id].value;
 
 	rc = msm_vidc_packetize_control(inst, cap_id, HFI_PAYLOAD_S32,
@@ -3999,10 +3622,6 @@ int msm_vidc_set_stage(void *instance,
 	struct msm_vidc_core *core;
 	struct msm_vidc_inst *inst = (struct msm_vidc_inst *)instance;
 
-	if (!inst || !inst->core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
 	core = inst->core;
 
 	rc = call_session_op(core, decide_work_mode, inst);
@@ -4029,10 +3648,6 @@ int msm_vidc_set_pipe(void *instance,
 	struct msm_vidc_core *core;
 	struct msm_vidc_inst *inst = (struct msm_vidc_inst *)instance;
 
-	if (!inst || !inst->core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
 	core = inst->core;
 
 	rc = call_session_op(core, decide_work_route, inst);
@@ -4058,11 +3673,6 @@ int msm_vidc_set_vui_timing_info(void *instance,
 	struct msm_vidc_inst *inst = (struct msm_vidc_inst *)instance;
 	u32 hfi_value;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	/*
 	 * hfi is HFI_PROP_DISABLE_VUI_TIMING_INFO and v4l2 cap is
 	 * V4L2_CID_MPEG_VIDC_VUI_TIMING_INFO and hence reverse
@@ -4088,11 +3698,6 @@ int msm_vidc_set_outbuf_fence_type(void *instance,
 	struct msm_vidc_inst *inst = (struct msm_vidc_inst *)instance;
 	u32 hfi_value;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	if (inst->capabilities[OUTBUF_FENCE_TYPE].value ==
 		MSM_VIDC_FENCE_NONE)
 		return 0;
@@ -4114,11 +3719,6 @@ int msm_vidc_set_outbuf_fence_direction(void *instance,
 	struct msm_vidc_inst *inst = (struct msm_vidc_inst *)instance;
 	u32 hfi_value;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	if (inst->capabilities[OUTBUF_FENCE_DIRECTION].value ==
 		MSM_VIDC_FENCE_DIR_NONE)
 		return 0;

+ 0 - 35
driver/platform/common/src/msm_vidc_platform_ext.c

@@ -20,11 +20,6 @@ int msm_vidc_adjust_ir_period(void *instance, struct v4l2_ctrl *ctrl)
 		pix_fmts = MSM_VIDC_FMT_NONE;
 	struct msm_vidc_inst *inst = (struct msm_vidc_inst *) instance;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	adjusted_value = ctrl ? ctrl->val : inst->capabilities[IR_PERIOD].value;
 
 	if (msm_vidc_get_parent_value(inst, IR_PERIOD, ALL_INTRA,
@@ -83,11 +78,6 @@ int msm_vidc_adjust_dec_frame_rate(void *instance, struct v4l2_ctrl *ctrl)
 	struct msm_vidc_inst *inst = (struct msm_vidc_inst *) instance;
 	u32 adjusted_value = 0;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	if (is_encode_session(inst)) {
 		d_vpr_e("%s: adjust framerate invalid for enc\n", __func__);
 		return -EINVAL;
@@ -104,11 +94,6 @@ int msm_vidc_adjust_dec_operating_rate(void *instance, struct v4l2_ctrl *ctrl)
 	struct msm_vidc_inst *inst = (struct msm_vidc_inst *) instance;
 	u32 adjusted_value = 0;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	if (is_encode_session(inst)) {
 		d_vpr_e("%s: adjust operating rate invalid for enc\n", __func__);
 		return -EINVAL;
@@ -126,11 +111,6 @@ int msm_vidc_adjust_delivery_mode(void *instance, struct v4l2_ctrl *ctrl)
 	s32 slice_mode = -1;
 	struct msm_vidc_inst *inst = (struct msm_vidc_inst *) instance;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	if (is_decode_session(inst))
 		return 0;
 
@@ -159,11 +139,6 @@ int msm_vidc_set_ir_period(void *instance,
 	u32 ir_type = 0;
 	struct msm_vidc_core *core;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	core = inst->core;
 
 	if (inst->capabilities[IR_TYPE].value ==
@@ -207,11 +182,6 @@ int msm_vidc_set_signal_color_info(void *instance,
 	/* Unspecified video format */
 	u32 video_format = 5;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	if (!(inst->capabilities[cap_id].flags & CAP_FLAG_CLIENT_SET)) {
 		i_vpr_h(inst, "%s: colorspace not configured via control\n", __func__);
 		return 0;
@@ -273,11 +243,6 @@ int msm_vidc_adjust_csc(void *instance, struct v4l2_ctrl *ctrl)
 	s32 pix_fmt = -1;
 	struct msm_vidc_inst *inst = (struct msm_vidc_inst *) instance;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	if (is_decode_session(inst))
 		return 0;
 

+ 0 - 4
driver/platform/pineapple/src/msm_vidc_pineapple.c

@@ -335,10 +335,6 @@ static int msm_vidc_set_ring_buffer_count_pineapple(void *instance,
 	u32 count = 0, data_size = 0, pixel_count = 0, fps = 0;
 	u32 frame_rate = 0, operating_rate = 0;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
 	core = inst->core;
 	output_fmt = &inst->fmts[OUTPUT_PORT];
 	input_fmt = &inst->fmts[INPUT_PORT];

+ 0 - 4
driver/platform/pineapple/src/pineapple.c

@@ -234,10 +234,6 @@ static int msm_vidc_set_ring_buffer_count_pineapple(void *instance,
 	u32 count = 0, data_size = 0, pixel_count = 0, fps = 0;
 	u32 frame_rate = 0, operating_rate = 0;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
 	core = inst->core;
 	output_fmt = &inst->fmts[OUTPUT_PORT];
 	input_fmt = &inst->fmts[INPUT_PORT];

+ 0 - 79
driver/variant/iris2/src/msm_vidc_buffer_iris2.c

@@ -24,10 +24,6 @@ static u32 msm_vidc_decoder_bin_size_iris2(struct msm_vidc_inst *inst)
 	bool is_interlaced;
 	u32 vpp_delay;
 
-	if (!inst || !inst->core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return size;
-	}
 	core = inst->core;
 
 	num_vpp_pipes = core->capabilities[NUM_VPP_PIPE].value;
@@ -64,11 +60,6 @@ static u32 msm_vidc_decoder_comv_size_iris2(struct msm_vidc_inst* inst)
 	u32 width, height, out_min_count, vpp_delay;
 	struct v4l2_format* f;
 
-	if (!inst || !inst->core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return size;
-	}
-
 	f = &inst->fmts[INPUT_PORT];
 	width = f->fmt.pix_mp.width;
 	height = f->fmt.pix_mp.height;
@@ -95,10 +86,6 @@ static u32 msm_vidc_decoder_non_comv_size_iris2(struct msm_vidc_inst* inst)
 	struct msm_vidc_core* core;
 	struct v4l2_format* f;
 
-	if (!inst || !inst->core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return size;
-	}
 	core = inst->core;
 
 	num_vpp_pipes = core->capabilities[NUM_VPP_PIPE].value;
@@ -125,10 +112,6 @@ static u32 msm_vidc_decoder_line_size_iris2(struct msm_vidc_inst *inst)
 	bool is_opb;
 	u32 color_fmt;
 
-	if (!inst || !inst->core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return size;
-	}
 	core = inst->core;
 
 	num_vpp_pipes = core->capabilities[NUM_VPP_PIPE].value;
@@ -174,11 +157,6 @@ static u32 msm_vidc_decoder_persist_size_iris2(struct msm_vidc_inst *inst)
 	u32 size = 0;
 	u32 rpu_enabled = 0;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return size;
-	}
-
 	if (inst->capabilities[META_DOLBY_RPU].value)
 		rpu_enabled = 1;
 
@@ -199,11 +177,6 @@ static u32 msm_vidc_decoder_dpb_size_iris2(struct msm_vidc_inst *inst)
 	u32 color_fmt, width, height, size = 0;
 	struct v4l2_format *f;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return size;
-	}
-
 	color_fmt = inst->capabilities[PIX_FMTS].value;
 	if (!is_linear_colorformat(color_fmt))
 		return size;
@@ -248,10 +221,6 @@ static u32 msm_vidc_encoder_bin_size_iris2(struct msm_vidc_inst *inst)
 	u32 width, height, num_vpp_pipes, stage;
 	struct v4l2_format *f;
 
-	if (!inst || !inst->core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return size;
-	}
 	core = inst->core;
 
 	num_vpp_pipes = core->capabilities[NUM_VPP_PIPE].value;
@@ -306,11 +275,6 @@ static u32 msm_vidc_encoder_comv_size_iris2(struct msm_vidc_inst* inst)
 	u32 width, height, num_recon = 0;
 	struct v4l2_format* f;
 
-	if (!inst || !inst->core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return size;
-	}
-
 	f = &inst->fmts[OUTPUT_PORT];
 	width = f->fmt.pix_mp.width;
 	height = f->fmt.pix_mp.height;
@@ -332,10 +296,6 @@ static u32 msm_vidc_encoder_non_comv_size_iris2(struct msm_vidc_inst* inst)
 	u32 width, height, num_vpp_pipes;
 	struct v4l2_format* f;
 
-	if (!inst || !inst->core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return size;
-	}
 	core = inst->core;
 
 	num_vpp_pipes = core->capabilities[NUM_VPP_PIPE].value;
@@ -360,10 +320,6 @@ static u32 msm_vidc_encoder_line_size_iris2(struct msm_vidc_inst *inst)
 	bool is_tenbit = false;
 	struct v4l2_format *f;
 
-	if (!inst || !inst->core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return size;
-	}
 	core = inst->core;
 
 	num_vpp_pipes = core->capabilities[NUM_VPP_PIPE].value;
@@ -390,11 +346,6 @@ static u32 msm_vidc_encoder_dpb_size_iris2(struct msm_vidc_inst *inst)
 	struct v4l2_format *f;
 	bool is_tenbit;
 
-	if (!inst || !inst->core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return 0;
-	}
-
 	f = &inst->fmts[OUTPUT_PORT];
 	width = f->fmt.pix_mp.width;
 	height = f->fmt.pix_mp.height;
@@ -415,11 +366,6 @@ static u32 msm_vidc_encoder_arp_size_iris2(struct msm_vidc_inst *inst)
 {
 	u32 size = 0;
 
-	if (!inst || !inst->core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return 0;
-	}
-
 	HFI_BUFFER_ARP_ENC(size);
 	i_vpr_l(inst, "%s: size %d\n", __func__, size);
 	return size;
@@ -433,11 +379,6 @@ static u32 msm_vidc_encoder_vpss_size_iris2(struct msm_vidc_inst* inst)
 	u32 width, height, driver_colorfmt;
 	struct v4l2_format* f;
 
-	if (!inst || !inst->core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return 0;
-	}
-
 	ds_enable = is_scaling_enabled(inst);
 	msm_vidc_v4l2_to_hfi_enum(inst, ROTATION, &rotation_val);
 
@@ -543,11 +484,6 @@ static int msm_vidc_input_min_count_iris2(struct msm_vidc_inst* inst)
 	u32 input_min_count = 0;
 	u32 total_hb_layer = 0;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return 0;
-	}
-
 	if (is_decode_session(inst)) {
 		input_min_count = MIN_DEC_INPUT_BUFFERS;
 	} else if (is_encode_session(inst)) {
@@ -575,11 +511,6 @@ static int msm_buffer_dpb_count(struct msm_vidc_inst *inst)
 	int count = 0;
 	u32 color_fmt;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return 0;
-	}
-
 	/* decoder dpb buffer count */
 	if (is_decode_session(inst)) {
 		color_fmt = inst->capabilities[PIX_FMTS].value;
@@ -598,11 +529,6 @@ int msm_buffer_min_count_iris2(struct msm_vidc_inst *inst,
 {
 	int count = 0;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return 0;
-	}
-
 	switch (buffer_type) {
 	case MSM_VIDC_BUF_INPUT:
 	case MSM_VIDC_BUF_INPUT_META:
@@ -637,11 +563,6 @@ int msm_buffer_extra_count_iris2(struct msm_vidc_inst *inst,
 {
 	int count = 0;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return 0;
-	}
-
 	switch (buffer_type) {
 	case MSM_VIDC_BUF_INPUT:
 	case MSM_VIDC_BUF_INPUT_META:

+ 0 - 20
driver/variant/iris2/src/msm_vidc_iris2.c

@@ -815,11 +815,6 @@ int msm_vidc_decide_work_mode_iris2(struct msm_vidc_inst* inst)
 	u32 width, height;
 	bool res_ok = false;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	work_mode = MSM_VIDC_STAGE_2;
 	inp_f = &inst->fmts[INPUT_PORT];
 
@@ -871,11 +866,6 @@ int msm_vidc_decide_work_route_iris2(struct msm_vidc_inst* inst)
 	u32 work_route;
 	struct msm_vidc_core* core;
 
-	if (!inst || !inst->core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	core = inst->core;
 	work_route = core->capabilities[NUM_VPP_PIPE].value;
 
@@ -914,11 +904,6 @@ int msm_vidc_adjust_blur_type_iris2(void *instance, struct v4l2_ctrl *ctrl)
 	s32 rc_type = -1, cac = -1;
 	s32 pix_fmts = -1, min_quality = -1;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	adjusted_value = ctrl ? ctrl->val :
 		inst->capabilities[BLUR_TYPES].value;
 
@@ -960,11 +945,6 @@ int msm_vidc_decide_quality_mode_iris2(struct msm_vidc_inst* inst)
 	u32 mbpf, mbps, max_hq_mbpf, max_hq_mbps;
 	u32 mode = MSM_VIDC_POWER_SAVE_MODE;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	if (!is_encode_session(inst))
 		return 0;
 

+ 0 - 9
driver/variant/iris2/src/msm_vidc_power_iris2.c

@@ -22,16 +22,7 @@ u64 msm_vidc_calc_freq_iris2(struct msm_vidc_inst *inst, u32 data_size)
 	u32 base_cycles = 0;
 	u32 fps, mbpf;
 
-	if (!inst || !inst->core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return freq;
-	}
-
 	core = inst->core;
-	if (!core->resource) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return freq;
-	}
 
 	mbpf = msm_vidc_get_mbs_per_frame(inst);
 	fps = inst->max_rate;

+ 0 - 94
driver/variant/iris3/src/msm_vidc_buffer_iris3.c

@@ -24,10 +24,6 @@ static u32 msm_vidc_decoder_bin_size_iris3(struct msm_vidc_inst *inst)
 	bool is_interlaced;
 	u32 vpp_delay;
 
-	if (!inst || !inst->core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return size;
-	}
 	core = inst->core;
 
 	num_vpp_pipes = core->capabilities[NUM_VPP_PIPE].value;
@@ -66,11 +62,6 @@ static u32 msm_vidc_decoder_comv_size_iris3(struct msm_vidc_inst* inst)
 	u32 width, height, num_comv, vpp_delay;
 	struct v4l2_format *f;
 
-	if (!inst || !inst->core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return size;
-	}
-
 	f = &inst->fmts[INPUT_PORT];
 	width = f->fmt.pix_mp.width;
 	height = f->fmt.pix_mp.height;
@@ -124,10 +115,6 @@ static u32 msm_vidc_decoder_non_comv_size_iris3(struct msm_vidc_inst* inst)
 	struct msm_vidc_core* core;
 	struct v4l2_format* f;
 
-	if (!inst || !inst->core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return size;
-	}
 	core = inst->core;
 
 	num_vpp_pipes = core->capabilities[NUM_VPP_PIPE].value;
@@ -154,10 +141,6 @@ static u32 msm_vidc_decoder_line_size_iris3(struct msm_vidc_inst *inst)
 	bool is_opb;
 	u32 color_fmt;
 
-	if (!inst || !inst->core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return size;
-	}
 	core = inst->core;
 	num_vpp_pipes = core->capabilities[NUM_VPP_PIPE].value;
 
@@ -205,11 +188,6 @@ static u32 msm_vidc_decoder_partial_data_size_iris3(struct msm_vidc_inst *inst)
 	u32 width, height;
 	struct v4l2_format *f;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return size;
-	}
-
 	f = &inst->fmts[INPUT_PORT];
 	width = f->fmt.pix_mp.width;
 	height = f->fmt.pix_mp.height;
@@ -226,11 +204,6 @@ static u32 msm_vidc_decoder_persist_size_iris3(struct msm_vidc_inst *inst)
 	u32 size = 0;
 	u32 rpu_enabled = 0;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return size;
-	}
-
 	if (inst->capabilities[META_DOLBY_RPU].value)
 		rpu_enabled = 1;
 
@@ -268,11 +241,6 @@ static u32 msm_vidc_decoder_dpb_size_iris3(struct msm_vidc_inst *inst)
 	u32 width, height;
 	struct v4l2_format *f;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return size;
-	}
-
 	/*
 	 * For legacy codecs (non-AV1), DPB is calculated only
 	 * for linear formats. For AV1, DPB is needed for film-grain
@@ -330,10 +298,6 @@ static u32 msm_vidc_encoder_bin_size_iris3(struct msm_vidc_inst *inst)
 	u32 width, height, num_vpp_pipes, stage, profile;
 	struct v4l2_format *f;
 
-	if (!inst || !inst->core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return size;
-	}
 	core = inst->core;
 
 	num_vpp_pipes = core->capabilities[NUM_VPP_PIPE].value;
@@ -389,11 +353,6 @@ static u32 msm_vidc_encoder_comv_size_iris3(struct msm_vidc_inst* inst)
 	u32 width, height, num_recon = 0;
 	struct v4l2_format* f;
 
-	if (!inst || !inst->core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return size;
-	}
-
 	f = &inst->fmts[OUTPUT_PORT];
 	width = f->fmt.pix_mp.width;
 	height = f->fmt.pix_mp.height;
@@ -415,10 +374,6 @@ static u32 msm_vidc_encoder_non_comv_size_iris3(struct msm_vidc_inst* inst)
 	u32 width, height, num_vpp_pipes;
 	struct v4l2_format* f;
 
-	if (!inst || !inst->core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return size;
-	}
 	core = inst->core;
 
 	num_vpp_pipes = core->capabilities[NUM_VPP_PIPE].value;
@@ -443,10 +398,6 @@ static u32 msm_vidc_encoder_line_size_iris3(struct msm_vidc_inst *inst)
 	bool is_tenbit = false;
 	struct v4l2_format *f;
 
-	if (!inst || !inst->core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return size;
-	}
 	core = inst->core;
 	num_vpp_pipes = core->capabilities[NUM_VPP_PIPE].value;
 	pixfmt = inst->capabilities[PIX_FMTS].value;
@@ -472,11 +423,6 @@ static u32 msm_vidc_encoder_dpb_size_iris3(struct msm_vidc_inst *inst)
 	struct v4l2_format *f;
 	bool is_tenbit;
 
-	if (!inst || !inst->core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return 0;
-	}
-
 	f = &inst->fmts[OUTPUT_PORT];
 	width = f->fmt.pix_mp.width;
 	height = f->fmt.pix_mp.height;
@@ -497,11 +443,6 @@ static u32 msm_vidc_encoder_arp_size_iris3(struct msm_vidc_inst *inst)
 {
 	u32 size = 0;
 
-	if (!inst || !inst->core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return 0;
-	}
-
 	HFI_BUFFER_ARP_ENC(size);
 	i_vpr_l(inst, "%s: size %d\n", __func__, size);
 	return size;
@@ -515,11 +456,6 @@ static u32 msm_vidc_encoder_vpss_size_iris3(struct msm_vidc_inst* inst)
 	u32 width, height, driver_colorfmt;
 	struct v4l2_format* f;
 
-	if (!inst || !inst->core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return 0;
-	}
-
 	ds_enable = is_scaling_enabled(inst);
 	msm_vidc_v4l2_to_hfi_enum(inst, ROTATION, &rotation_val);
 
@@ -558,11 +494,6 @@ static u32 msm_vidc_encoder_output_size_iris3(struct msm_vidc_inst *inst)
 	u32 hfi_rc_type = HFI_RC_VBR_CFR;
 	enum msm_vidc_codec_type codec;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	f = &inst->fmts[OUTPUT_PORT];
 	codec = v4l2_codec_to_driver(inst, f->fmt.pix_mp.pixelformat, __func__);
 	if (codec == MSM_VIDC_HEVC || codec == MSM_VIDC_HEIC)
@@ -660,11 +591,6 @@ static int msm_vidc_input_min_count_iris3(struct msm_vidc_inst* inst)
 	u32 input_min_count = 0;
 	u32 total_hb_layer = 0;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return 0;
-	}
-
 	if (is_decode_session(inst)) {
 		input_min_count = MIN_DEC_INPUT_BUFFERS;
 	} else if (is_encode_session(inst)) {
@@ -692,11 +618,6 @@ static int msm_buffer_dpb_count(struct msm_vidc_inst *inst)
 	int count = 0;
 	u32 color_fmt;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return 0;
-	}
-
 	/* decoder dpb buffer count */
 	if (is_decode_session(inst)) {
 		color_fmt = inst->capabilities[PIX_FMTS].value;
@@ -722,11 +643,6 @@ static int msm_buffer_delivery_mode_based_min_count_iris3(struct msm_vidc_inst *
 	u32 slice_mode = 0;
 	u32 delivery_mode = 0;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return count;
-	}
-
 	slice_mode = inst->capabilities[SLICE_MODE].value;
 	delivery_mode = inst->capabilities[DELIVERY_MODE].value;
 
@@ -756,11 +672,6 @@ int msm_buffer_min_count_iris3(struct msm_vidc_inst *inst,
 {
 	int count = 0;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return 0;
-	}
-
 	switch (buffer_type) {
 	case MSM_VIDC_BUF_INPUT:
 	case MSM_VIDC_BUF_INPUT_META:
@@ -797,11 +708,6 @@ int msm_buffer_extra_count_iris3(struct msm_vidc_inst *inst,
 {
 	int count = 0;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return 0;
-	}
-
 	switch (buffer_type) {
 	case MSM_VIDC_BUF_INPUT:
 	case MSM_VIDC_BUF_INPUT_META:

+ 0 - 20
driver/variant/iris3/src/msm_vidc_iris3.c

@@ -862,11 +862,6 @@ int msm_vidc_decide_work_mode_iris3(struct msm_vidc_inst* inst)
 	u32 width, height;
 	bool res_ok = false;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	work_mode = MSM_VIDC_STAGE_2;
 	inp_f = &inst->fmts[INPUT_PORT];
 
@@ -922,11 +917,6 @@ int msm_vidc_decide_work_route_iris3(struct msm_vidc_inst* inst)
 	u32 work_route;
 	struct msm_vidc_core* core;
 
-	if (!inst || !inst->core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	core = inst->core;
 	work_route = core->capabilities[NUM_VPP_PIPE].value;
 
@@ -964,11 +954,6 @@ int msm_vidc_decide_quality_mode_iris3(struct msm_vidc_inst* inst)
 	u32 mbpf, mbps, max_hq_mbpf, max_hq_mbps;
 	u32 mode = MSM_VIDC_POWER_SAVE_MODE;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	if (!is_encode_session(inst))
 		return 0;
 
@@ -1018,11 +1003,6 @@ int msm_vidc_adjust_bitrate_boost_iris3(void* instance, struct v4l2_ctrl *ctrl)
 	struct v4l2_format *f;
 	u32 max_bitrate = 0, bitrate = 0;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	adjusted_value = ctrl ? ctrl->val :
 		inst->capabilities[BITRATE_BOOST].value;
 

+ 0 - 14
driver/variant/iris3/src/msm_vidc_power_iris3.c

@@ -293,11 +293,6 @@ static u64 msm_vidc_calc_freq_iris3_new(struct msm_vidc_inst *inst, u32 data_siz
 	struct api_calculation_freq_output codec_output;
 	u32 fps, mbpf;
 
-	if (!inst || !inst->core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return freq;
-	}
-
 	core = inst->core;
 
 	mbpf = msm_vidc_get_mbs_per_frame(inst);
@@ -362,11 +357,6 @@ u64 msm_vidc_calc_freq_iris3(struct msm_vidc_inst *inst, u32 data_size)
 {
 	u64 freq = 0;
 
-	if (!inst || !inst->core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return freq;
-	}
-
 	if (ENABLE_LEGACY_POWER_CALCULATIONS)
 		freq = msm_vidc_calc_freq_iris3_legacy(inst, data_size);
 	else
@@ -387,10 +377,6 @@ static u64 msm_vidc_calc_freq_iris3_legacy(struct msm_vidc_inst *inst, u32 data_
 	u32 base_cycles = 0;
 	u32 fps, mbpf;
 
-	if (!inst || !inst->core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return freq;
-	}
 	core = inst->core;
 
 	if (!core->resource || !core->resource->freq_set.freq_tbl ||

+ 0 - 94
driver/variant/iris33/src/msm_vidc_buffer_iris33.c

@@ -24,10 +24,6 @@ static u32 msm_vidc_decoder_bin_size_iris33(struct msm_vidc_inst *inst)
 	bool is_interlaced;
 	u32 vpp_delay;
 
-	if (!inst || !inst->core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return size;
-	}
 	core = inst->core;
 
 	num_vpp_pipes = core->capabilities[NUM_VPP_PIPE].value;
@@ -66,11 +62,6 @@ static u32 msm_vidc_decoder_comv_size_iris33(struct msm_vidc_inst* inst)
 	u32 width, height, num_comv, vpp_delay;
 	struct v4l2_format *f;
 
-	if (!inst || !inst->core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return size;
-	}
-
 	f = &inst->fmts[INPUT_PORT];
 	width = f->fmt.pix_mp.width;
 	height = f->fmt.pix_mp.height;
@@ -124,10 +115,6 @@ static u32 msm_vidc_decoder_non_comv_size_iris33(struct msm_vidc_inst* inst)
 	struct msm_vidc_core* core;
 	struct v4l2_format* f;
 
-	if (!inst || !inst->core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return size;
-	}
 	core = inst->core;
 
 	num_vpp_pipes = core->capabilities[NUM_VPP_PIPE].value;
@@ -154,10 +141,6 @@ static u32 msm_vidc_decoder_line_size_iris33(struct msm_vidc_inst *inst)
 	bool is_opb;
 	u32 color_fmt;
 
-	if (!inst || !inst->core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return size;
-	}
 	core = inst->core;
 	num_vpp_pipes = core->capabilities[NUM_VPP_PIPE].value;
 
@@ -205,11 +188,6 @@ static u32 msm_vidc_decoder_partial_data_size_iris33(struct msm_vidc_inst *inst)
 	u32 width, height;
 	struct v4l2_format *f;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return size;
-	}
-
 	f = &inst->fmts[INPUT_PORT];
 	width = f->fmt.pix_mp.width;
 	height = f->fmt.pix_mp.height;
@@ -226,11 +204,6 @@ static u32 msm_vidc_decoder_persist_size_iris33(struct msm_vidc_inst *inst)
 	u32 size = 0;
 	u32 rpu_enabled = 0;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return size;
-	}
-
 	if (inst->capabilities[META_DOLBY_RPU].value)
 		rpu_enabled = 1;
 
@@ -269,11 +242,6 @@ static u32 msm_vidc_decoder_dpb_size_iris33(struct msm_vidc_inst *inst)
 	u32 interlace = 0;
 	struct v4l2_format *f;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return size;
-	}
-
 	/*
 	 * For legacy codecs (non-AV1), DPB is calculated only
 	 * for linear formats. For AV1, DPB is needed for film-grain
@@ -337,10 +305,6 @@ static u32 msm_vidc_encoder_bin_size_iris33(struct msm_vidc_inst *inst)
 	u32 width, height, num_vpp_pipes, stage, profile, ring_buf_count;
 	struct v4l2_format *f;
 
-	if (!inst || !inst->core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return size;
-	}
 	core = inst->core;
 
 	num_vpp_pipes = core->capabilities[NUM_VPP_PIPE].value;
@@ -397,11 +361,6 @@ static u32 msm_vidc_encoder_comv_size_iris33(struct msm_vidc_inst* inst)
 	u32 width, height, num_recon = 0;
 	struct v4l2_format* f;
 
-	if (!inst || !inst->core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return size;
-	}
-
 	f = &inst->fmts[OUTPUT_PORT];
 	width = f->fmt.pix_mp.width;
 	height = f->fmt.pix_mp.height;
@@ -423,10 +382,6 @@ static u32 msm_vidc_encoder_non_comv_size_iris33(struct msm_vidc_inst* inst)
 	u32 width, height, num_vpp_pipes;
 	struct v4l2_format* f;
 
-	if (!inst || !inst->core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return size;
-	}
 	core = inst->core;
 
 	num_vpp_pipes = core->capabilities[NUM_VPP_PIPE].value;
@@ -451,10 +406,6 @@ static u32 msm_vidc_encoder_line_size_iris33(struct msm_vidc_inst *inst)
 	bool is_tenbit = false;
 	struct v4l2_format *f;
 
-	if (!inst || !inst->core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return size;
-	}
 	core = inst->core;
 	num_vpp_pipes = core->capabilities[NUM_VPP_PIPE].value;
 	pixfmt = inst->capabilities[PIX_FMTS].value;
@@ -480,11 +431,6 @@ static u32 msm_vidc_encoder_dpb_size_iris33(struct msm_vidc_inst *inst)
 	struct v4l2_format *f;
 	bool is_tenbit;
 
-	if (!inst || !inst->core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return 0;
-	}
-
 	f = &inst->fmts[OUTPUT_PORT];
 	width = f->fmt.pix_mp.width;
 	height = f->fmt.pix_mp.height;
@@ -505,11 +451,6 @@ static u32 msm_vidc_encoder_arp_size_iris33(struct msm_vidc_inst *inst)
 {
 	u32 size = 0;
 
-	if (!inst || !inst->core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return 0;
-	}
-
 	HFI_BUFFER_ARP_ENC(size);
 	i_vpr_l(inst, "%s: size %d\n", __func__, size);
 	return size;
@@ -523,11 +464,6 @@ static u32 msm_vidc_encoder_vpss_size_iris33(struct msm_vidc_inst* inst)
 	u32 width, height, driver_colorfmt;
 	struct v4l2_format* f;
 
-	if (!inst || !inst->core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return 0;
-	}
-
 	ds_enable = is_scaling_enabled(inst);
 	msm_vidc_v4l2_to_hfi_enum(inst, ROTATION, &rotation_val);
 
@@ -566,11 +502,6 @@ static u32 msm_vidc_encoder_output_size_iris33(struct msm_vidc_inst *inst)
 	u32 hfi_rc_type = HFI_RC_VBR_CFR;
 	enum msm_vidc_codec_type codec;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	f = &inst->fmts[OUTPUT_PORT];
 	codec = v4l2_codec_to_driver(inst, f->fmt.pix_mp.pixelformat, __func__);
 	if (codec == MSM_VIDC_HEVC || codec == MSM_VIDC_HEIC)
@@ -668,11 +599,6 @@ static int msm_vidc_input_min_count_iris33(struct msm_vidc_inst* inst)
 	u32 input_min_count = 0;
 	u32 total_hb_layer = 0;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return 0;
-	}
-
 	if (is_decode_session(inst)) {
 		input_min_count = MIN_DEC_INPUT_BUFFERS;
 	} else if (is_encode_session(inst)) {
@@ -700,11 +626,6 @@ static int msm_buffer_dpb_count(struct msm_vidc_inst *inst)
 	int count = 0;
 	u32 color_fmt;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return 0;
-	}
-
 	/* decoder dpb buffer count */
 	if (is_decode_session(inst)) {
 		color_fmt = inst->capabilities[PIX_FMTS].value;
@@ -730,11 +651,6 @@ static int msm_buffer_delivery_mode_based_min_count_iris33(struct msm_vidc_inst
 	u32 slice_mode = 0;
 	u32 delivery_mode = 0;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return count;
-	}
-
 	slice_mode = inst->capabilities[SLICE_MODE].value;
 	delivery_mode = inst->capabilities[DELIVERY_MODE].value;
 
@@ -764,11 +680,6 @@ int msm_buffer_min_count_iris33(struct msm_vidc_inst *inst,
 {
 	int count = 0;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return 0;
-	}
-
 	switch (buffer_type) {
 	case MSM_VIDC_BUF_INPUT:
 	case MSM_VIDC_BUF_INPUT_META:
@@ -805,11 +716,6 @@ int msm_buffer_extra_count_iris33(struct msm_vidc_inst *inst,
 {
 	int count = 0;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return 0;
-	}
-
 	switch (buffer_type) {
 	case MSM_VIDC_BUF_INPUT:
 	case MSM_VIDC_BUF_INPUT_META:

+ 0 - 20
driver/variant/iris33/src/msm_vidc_iris33.c

@@ -1111,11 +1111,6 @@ int msm_vidc_decide_work_mode_iris33(struct msm_vidc_inst* inst)
 	u32 width, height;
 	bool res_ok = false;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	work_mode = MSM_VIDC_STAGE_2;
 	inp_f = &inst->fmts[INPUT_PORT];
 
@@ -1171,11 +1166,6 @@ int msm_vidc_decide_work_route_iris33(struct msm_vidc_inst* inst)
 	u32 work_route;
 	struct msm_vidc_core* core;
 
-	if (!inst || !inst->core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	core = inst->core;
 	work_route = core->capabilities[NUM_VPP_PIPE].value;
 
@@ -1213,11 +1203,6 @@ int msm_vidc_decide_quality_mode_iris33(struct msm_vidc_inst* inst)
 	u32 mbpf, mbps, max_hq_mbpf, max_hq_mbps;
 	u32 mode = MSM_VIDC_POWER_SAVE_MODE;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	if (!is_encode_session(inst))
 		return 0;
 
@@ -1267,11 +1252,6 @@ int msm_vidc_adjust_bitrate_boost_iris33(void* instance, struct v4l2_ctrl *ctrl)
 	struct v4l2_format *f;
 	u32 max_bitrate = 0, bitrate = 0;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	adjusted_value = ctrl ? ctrl->val :
 		inst->capabilities[BITRATE_BOOST].value;
 

+ 0 - 18
driver/variant/iris33/src/msm_vidc_power_iris33.c

@@ -414,11 +414,6 @@ static u64 msm_vidc_calc_freq_iris33_new(struct msm_vidc_inst *inst, u32 data_si
 	struct api_calculation_freq_output codec_output;
 	u32 fps, mbpf;
 
-	if (!inst || !inst->core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return freq;
-	}
-
 	core = inst->core;
 
 	mbpf = msm_vidc_get_mbs_per_frame(inst);
@@ -511,11 +506,6 @@ u64 msm_vidc_calc_freq_iris33(struct msm_vidc_inst *inst, u32 data_size)
 {
 	u64 freq = 0;
 
-	if (!inst || !inst->core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return freq;
-	}
-
 	if (ENABLE_LEGACY_POWER_CALCULATIONS)
 		freq = msm_vidc_calc_freq_iris33_legacy(inst, data_size);
 	else
@@ -536,10 +526,6 @@ u64 msm_vidc_calc_freq_iris33_legacy(struct msm_vidc_inst *inst, u32 data_size)
 	u32 base_cycles = 0;
 	u32 fps, mbpf;
 
-	if (!inst || !inst->core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return freq;
-	}
 	core = inst->core;
 
 	if (!core->resource || !core->resource->freq_set.freq_tbl ||
@@ -1335,10 +1321,6 @@ int msm_vidc_ring_buf_count_iris33(struct msm_vidc_inst *inst, u32 data_size)
 	struct api_calculation_input codec_input;
 	struct api_calculation_freq_output codec_output;
 
-	if (!inst || !inst->core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
 	core = inst->core;
 
 	if (!core->resource || !core->resource->freq_set.freq_tbl ||

+ 32 - 32
driver/vidc/inc/msm_vidc.h

@@ -15,43 +15,43 @@ union msm_v4l2_cmd {
 	struct v4l2_encoder_cmd enc;
 };
 
-void *msm_vidc_open(void *core, u32 session_type);
-int msm_vidc_close(void *instance);
-int msm_vidc_querycap(void *instance, struct v4l2_capability *cap);
-int msm_vidc_enum_fmt(void *instance, struct v4l2_fmtdesc *f);
-int msm_vidc_try_fmt(void *instance, struct v4l2_format *f);
-int msm_vidc_s_fmt(void *instance, struct v4l2_format *f);
-int msm_vidc_g_fmt(void *instance, struct v4l2_format *f);
-int msm_vidc_s_selection(void* instance, struct v4l2_selection* s);
-int msm_vidc_g_selection(void* instance, struct v4l2_selection* s);
-int msm_vidc_s_param(void *instance, struct v4l2_streamparm *sp);
-int msm_vidc_g_param(void *instance, struct v4l2_streamparm *sp);
-int msm_vidc_reqbufs(void *instance, struct v4l2_requestbuffers *b);
-int msm_vidc_querybuf(void *instance, struct v4l2_buffer *b);
-int msm_vidc_create_bufs(void *instance, struct v4l2_create_buffers *b);
-int msm_vidc_prepare_buf(void *instance, struct media_device *mdev,
+void *msm_vidc_open(struct msm_vidc_core *core, u32 session_type);
+int msm_vidc_close(struct msm_vidc_inst *inst);
+int msm_vidc_querycap(struct msm_vidc_inst *inst, struct v4l2_capability *cap);
+int msm_vidc_enum_fmt(struct msm_vidc_inst *inst, struct v4l2_fmtdesc *f);
+int msm_vidc_try_fmt(struct msm_vidc_inst *inst, struct v4l2_format *f);
+int msm_vidc_s_fmt(struct msm_vidc_inst *inst, struct v4l2_format *f);
+int msm_vidc_g_fmt(struct msm_vidc_inst *inst, struct v4l2_format *f);
+int msm_vidc_s_selection(struct msm_vidc_inst *inst, struct v4l2_selection* s);
+int msm_vidc_g_selection(struct msm_vidc_inst *inst, struct v4l2_selection* s);
+int msm_vidc_s_param(struct msm_vidc_inst *inst, struct v4l2_streamparm *sp);
+int msm_vidc_g_param(struct msm_vidc_inst *inst, struct v4l2_streamparm *sp);
+int msm_vidc_reqbufs(struct msm_vidc_inst *inst, struct v4l2_requestbuffers *b);
+int msm_vidc_querybuf(struct msm_vidc_inst *inst, struct v4l2_buffer *b);
+int msm_vidc_create_bufs(struct msm_vidc_inst *inst, struct v4l2_create_buffers *b);
+int msm_vidc_prepare_buf(struct msm_vidc_inst *inst, struct media_device *mdev,
 	struct v4l2_buffer *b);
-int msm_vidc_release_buffer(void *instance, int buffer_type,
+int msm_vidc_release_buffer(struct msm_vidc_inst *inst, int buffer_type,
 		unsigned int buffer_index);
-int msm_vidc_qbuf(void *instance, struct media_device *mdev,
+int msm_vidc_qbuf(struct msm_vidc_inst *inst, struct media_device *mdev,
 		struct v4l2_buffer *b);
-int msm_vidc_dqbuf(void *instance, struct v4l2_buffer *b);
-int msm_vidc_streamon(void *instance, enum v4l2_buf_type i);
-int msm_vidc_query_ctrl(void *instance, struct v4l2_queryctrl *ctrl);
-int msm_vidc_query_menu(void *instance, struct v4l2_querymenu *qmenu);
-int msm_vidc_streamoff(void *instance, enum v4l2_buf_type i);
-int msm_vidc_try_cmd(void *instance, union msm_v4l2_cmd *cmd);
-int msm_vidc_start_cmd(void *instance);
-int msm_vidc_stop_cmd(void *instance);
-int msm_vidc_poll(void *instance, struct file *filp,
+int msm_vidc_dqbuf(struct msm_vidc_inst *inst, struct v4l2_buffer *b);
+int msm_vidc_streamon(struct msm_vidc_inst *inst, enum v4l2_buf_type i);
+int msm_vidc_query_ctrl(struct msm_vidc_inst *inst, struct v4l2_queryctrl *ctrl);
+int msm_vidc_query_menu(struct msm_vidc_inst *inst, struct v4l2_querymenu *qmenu);
+int msm_vidc_streamoff(struct msm_vidc_inst *inst, enum v4l2_buf_type i);
+int msm_vidc_try_cmd(struct msm_vidc_inst *inst, union msm_v4l2_cmd *cmd);
+int msm_vidc_start_cmd(struct msm_vidc_inst *inst);
+int msm_vidc_stop_cmd(struct msm_vidc_inst *inst);
+int msm_vidc_poll(struct msm_vidc_inst *inst, struct file *filp,
 		struct poll_table_struct *pt);
-int msm_vidc_subscribe_event(void *instance,
+int msm_vidc_subscribe_event(struct msm_vidc_inst *inst,
 		const struct v4l2_event_subscription *sub);
-int msm_vidc_unsubscribe_event(void *instance,
+int msm_vidc_unsubscribe_event(struct msm_vidc_inst *inst,
 		const struct v4l2_event_subscription *sub);
-int msm_vidc_dqevent(void *instance, struct v4l2_event *event);
-int msm_vidc_g_crop(void *instance, struct v4l2_crop *a);
-int msm_vidc_enum_framesizes(void *instance, struct v4l2_frmsizeenum *fsize);
-int msm_vidc_enum_frameintervals(void *instance, struct v4l2_frmivalenum *fival);
+int msm_vidc_dqevent(struct msm_vidc_inst *inst, struct v4l2_event *event);
+int msm_vidc_g_crop(struct msm_vidc_inst *inst, struct v4l2_crop *a);
+int msm_vidc_enum_framesizes(struct msm_vidc_inst *inst, struct v4l2_frmsizeenum *fsize);
+int msm_vidc_enum_frameintervals(struct msm_vidc_inst *inst, struct v4l2_frmivalenum *fival);
 
 #endif

+ 8 - 5
driver/vidc/inc/msm_vidc_debug.h

@@ -14,6 +14,9 @@
 #include <linux/module.h>
 #include <linux/moduleparam.h>
 
+struct msm_vidc_core;
+struct msm_vidc_inst;
+
 #ifndef VIDC_DBG_LABEL
 #define VIDC_DBG_LABEL "msm_vidc"
 #endif
@@ -172,14 +175,14 @@ enum msm_vidc_bug_on_error {
 };
 
 struct dentry *msm_vidc_debugfs_init_drv(void);
-struct dentry *msm_vidc_debugfs_init_core(void *core);
-struct dentry *msm_vidc_debugfs_init_inst(void *inst,
+struct dentry *msm_vidc_debugfs_init_core(struct msm_vidc_core *core);
+struct dentry *msm_vidc_debugfs_init_inst(struct msm_vidc_inst *inst,
 		struct dentry *parent);
-void msm_vidc_debugfs_deinit_inst(void *inst);
-void msm_vidc_debugfs_update(void *inst,
+void msm_vidc_debugfs_deinit_inst(struct msm_vidc_inst *inst);
+void msm_vidc_debugfs_update(struct msm_vidc_inst *inst,
 		enum msm_vidc_debugfs_event e);
 int msm_vidc_check_ratelimit(void);
-void msm_vidc_show_stats(void *inst);
+void msm_vidc_show_stats(struct msm_vidc_inst *inst);
 
 static inline bool is_stats_enabled(void)
 {

+ 1 - 30
driver/vidc/src/hfi_packet.c

@@ -16,11 +16,6 @@ u32 get_hfi_port(struct msm_vidc_inst *inst,
 {
 	u32 hfi_port = HFI_PORT_NONE;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return hfi_port;
-	}
-
 	if (is_decode_session(inst)) {
 		switch (port) {
 		case INPUT_PORT:
@@ -64,11 +59,6 @@ u32 get_hfi_port_from_buffer_type(struct msm_vidc_inst *inst,
 {
 	u32 hfi_port = HFI_PORT_NONE;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return hfi_port;
-	}
-
 	if (is_decode_session(inst)) {
 		switch (buffer_type) {
 		case MSM_VIDC_BUF_INPUT:
@@ -219,11 +209,6 @@ u32 hfi_buf_type_to_driver(enum msm_vidc_domain_type domain,
 
 u32 get_hfi_codec(struct msm_vidc_inst *inst)
 {
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return 0;
-	}
-
 	switch (inst->codec) {
 	case MSM_VIDC_H264:
 		if (inst->domain == MSM_VIDC_ENCODER)
@@ -252,12 +237,7 @@ u32 get_hfi_colorformat(struct msm_vidc_inst *inst,
 {
 	u32 hfi_colorformat = HFI_COLOR_FMT_NV12_UBWC;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return hfi_colorformat;
-	}
-
-	switch (colorformat) {
+	switch(colorformat) {
 	case MSM_VIDC_FMT_NV12:
 		hfi_colorformat = HFI_COLOR_FMT_NV12;
 		break;
@@ -312,11 +292,6 @@ static u32 get_hfi_region_flag(enum msm_vidc_buffer_region region)
 int get_hfi_buffer(struct msm_vidc_inst *inst,
 	struct msm_vidc_buffer *buffer, struct hfi_buffer *buf)
 {
-	if (!inst || !buffer || !buf) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	memset(buf, 0, sizeof(struct hfi_buffer));
 	buf->type = hfi_buf_type_from_driver(inst->domain, buffer->type);
 	buf->index = buffer->index;
@@ -691,10 +666,6 @@ int hfi_packet_session_command(struct msm_vidc_inst *inst,
 	int rc = 0;
 	struct msm_vidc_core *core;
 
-	if (!inst || !inst->core || !inst->packet) {
-		d_vpr_e("%s: Invalid params\n", __func__);
-		return -EINVAL;
-	}
 	core = inst->core;
 
 	rc = hfi_create_header(inst->packet, inst->packet_size,

+ 2 - 145
driver/vidc/src/msm_vdec.c

@@ -673,11 +673,6 @@ static int msm_vdec_set_output_properties(struct msm_vidc_inst *inst)
 {
 	int rc = 0;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	rc = msm_vdec_set_opb_enable(inst);
 	if (rc)
 		return rc;
@@ -706,11 +701,6 @@ int msm_vdec_get_input_internal_buffers(struct msm_vidc_inst *inst)
 	int rc = 0;
 	u32 i = 0;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	for (i = 0; i < ARRAY_SIZE(msm_vdec_internal_buffer_type); i++) {
 		rc = msm_vidc_get_internal_buffers(inst, msm_vdec_internal_buffer_type[i]);
 		if (rc)
@@ -724,11 +714,6 @@ static int msm_vdec_get_output_internal_buffers(struct msm_vidc_inst *inst)
 {
 	int rc = 0;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	rc = msm_vidc_get_internal_buffers(inst, MSM_VIDC_BUF_DPB);
 	if (rc)
 		return rc;
@@ -869,10 +854,6 @@ static int msm_vdec_subscribe_input_port_settings_change(struct msm_vidc_inst *i
 		{HFI_PROP_AV1_SUPER_BLOCK_ENABLED,       msm_vdec_set_av1_superblock_enabled },
 	};
 
-	if (!inst || !inst->core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
 	i_vpr_h(inst, "%s()\n", __func__);
 
 	core = inst->core;
@@ -947,10 +928,6 @@ static int msm_vdec_subscribe_property(struct msm_vidc_inst *inst,
 	u32 subscribe_prop_size;
 	const u32 *subcribe_prop;
 
-	if (!inst || !inst->core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
 	core = inst->core;
 	i_vpr_h(inst, "%s()\n", __func__);
 
@@ -1048,10 +1025,6 @@ static int msm_vdec_subscribe_metadata(struct msm_vidc_inst *inst,
 	u32 payload[32] = {0};
 	u32 i, count = 0;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
 	i_vpr_h(inst, "%s()\n", __func__);
 
 	payload[0] = HFI_MODE_METADATA;
@@ -1109,10 +1082,6 @@ static int msm_vdec_set_delivery_mode_metadata(struct msm_vidc_inst *inst,
 	u32 payload[32] = {0};
 	u32 i, count = 0;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
 	i_vpr_h(inst, "%s()\n", __func__);
 
 	payload[0] = HFI_MODE_METADATA;
@@ -1173,10 +1142,6 @@ static int msm_vdec_set_delivery_mode_property(struct msm_vidc_inst *inst,
 	};
 	static const u32 property_input_list[] = {};
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
 	i_vpr_h(inst, "%s()\n", __func__);
 
 	payload[0] = HFI_MODE_PROPERTY;
@@ -1237,10 +1202,6 @@ int msm_vdec_init_input_subcr_params(struct msm_vidc_inst *inst)
 	u32 colour_description_present_flag = 0;
 	u32 video_signal_type_present_flag = 0;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
 	subsc_params = &inst->subcr_params[INPUT_PORT];
 
 	subsc_params->bitstream_resolution =
@@ -1296,11 +1257,6 @@ int msm_vdec_set_num_comv(struct msm_vidc_inst *inst)
 	int rc = 0;
 	u32 num_comv = 0;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	num_comv = inst->capabilities[NUM_COMV].value;
 	i_vpr_h(inst, "%s: num COMV: %d", __func__, num_comv);
 	rc = venus_hfi_session_property(inst,
@@ -1329,10 +1285,6 @@ static int msm_vdec_read_input_subcr_params(struct msm_vidc_inst *inst)
 	u32 video_signal_type_present_flag = 0;
 	enum msm_vidc_colorformat_type output_fmt;
 
-	if (!inst || !inst->core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
 	core = inst->core;
 
 	subsc_params = inst->subcr_params[INPUT_PORT];
@@ -1484,11 +1436,6 @@ int msm_vdec_streamoff_input(struct msm_vidc_inst *inst)
 {
 	int rc = 0;
 
-	if (!inst || !inst->core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	rc = msm_vidc_session_streamoff(inst, INPUT_PORT);
 	if (rc)
 		return rc;
@@ -1500,11 +1447,6 @@ int msm_vdec_streamon_input(struct msm_vidc_inst *inst)
 {
 	int rc = 0;
 
-	if (!inst || !inst->core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	if (is_input_meta_enabled(inst) &&
 		!inst->bufq[INPUT_META_PORT].vb2q->streaming) {
 		i_vpr_e(inst,
@@ -1625,11 +1567,6 @@ int msm_vdec_streamoff_output(struct msm_vidc_inst *inst)
 {
 	int rc = 0;
 
-	if (!inst || !inst->core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	/* cancel pending batch work */
 	cancel_batch_work(inst);
 	rc = msm_vidc_session_streamoff(inst, OUTPUT_PORT);
@@ -1651,10 +1588,6 @@ static int msm_vdec_subscribe_output_port_settings_change(struct msm_vidc_inst *
 	u32 subscribe_psc_size = 0;
 	const u32 *psc = NULL;
 
-	if (!inst || !inst->core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
 	i_vpr_h(inst, "%s()\n", __func__);
 
 	core = inst->core;
@@ -1797,11 +1730,6 @@ static int msm_vdec_update_max_map_output_count(struct msm_vidc_inst *inst)
 	struct v4l2_format *f;
 	u32 width, height, count;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	f = &inst->fmts[OUTPUT_PORT];
 	width = f->fmt.pix_mp.width;
 	height = f->fmt.pix_mp.height;
@@ -1833,11 +1761,6 @@ int msm_vdec_streamon_output(struct msm_vidc_inst *inst)
 {
 	int rc = 0;
 
-	if (!inst || !inst->core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	if (is_output_meta_enabled(inst) &&
 		!inst->bufq[OUTPUT_META_PORT].vb2q->streaming) {
 		i_vpr_e(inst,
@@ -1925,11 +1848,6 @@ static inline enum msm_vidc_allow msm_vdec_allow_queue_deferred_buffers(
 {
 	int count;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return MSM_VIDC_DISALLOW;
-	}
-
 	/* do not defer buffers initially to avoid latency issues */
 	if (inst->power.buffer_counter <= SKIP_BATCH_WINDOW)
 		return MSM_VIDC_ALLOW;
@@ -1949,7 +1867,7 @@ static int msm_vdec_qbuf_batch(struct msm_vidc_inst *inst,
 	enum msm_vidc_allow allow;
 	int rc;
 
-	if (!inst || !vb2 || !inst->decode_batch.size) {
+	if (!inst->decode_batch.size) {
 		d_vpr_e("%s: invalid params\n", __func__);
 		return -EINVAL;
 	}
@@ -1987,11 +1905,6 @@ static int msm_vdec_release_eligible_buffers(struct msm_vidc_inst *inst)
 	int rc = 0;
 	struct msm_vidc_buffer *ro_buf;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	list_for_each_entry(ro_buf, &inst->buffers.read_only.list, list) {
 		/* release only release eligible read-only buffers */
 		if (!(ro_buf->attr & MSM_VIDC_ATTR_RELEASE_ELIGIBLE))
@@ -2018,11 +1931,6 @@ static int msm_vdec_release_nonref_buffers(struct msm_vidc_inst *inst)
 	int i = 0;
 	bool found = false;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	/*
 	 * if DPB_LIST subscribed on output port then driver need to
 	 * hold MAX_BPB_COUNT of read only buffer at least.
@@ -2106,11 +2014,6 @@ int msm_vdec_qbuf(struct msm_vidc_inst *inst, struct vb2_buffer *vb2)
 {
 	int rc = 0;
 
-	if (!inst || !vb2) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	if (inst->adjust_priority) {
 		s32 priority = inst->capabilities[PRIORITY].value;
 
@@ -2152,11 +2055,6 @@ static int msm_vdec_alloc_and_queue_additional_dpb_buffers(struct msm_vidc_inst
 	struct msm_vidc_buffer *buffer = NULL;
 	int i, cur_min_count = 0, rc = 0;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	/* get latest min_count and size */
 	rc = msm_vidc_get_internal_buffers(inst, MSM_VIDC_BUF_DPB);
 	if (rc)
@@ -2208,11 +2106,6 @@ int msm_vdec_start_cmd(struct msm_vidc_inst *inst)
 {
 	int rc = 0;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	i_vpr_h(inst, "received cmd: resume\n");
 	vb2_clear_last_buffer_dequeued(inst->bufq[OUTPUT_META_PORT].vb2q);
 	vb2_clear_last_buffer_dequeued(inst->bufq[OUTPUT_PORT].vb2q);
@@ -2280,11 +2173,6 @@ int msm_vdec_try_fmt(struct msm_vidc_inst *inst, struct v4l2_format *f)
 	struct v4l2_pix_format_mplane *pixmp = &f->fmt.pix_mp;
 	u32 pix_fmt;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	memset(pixmp->reserved, 0, sizeof(pixmp->reserved));
 	if (f->type == INPUT_MPLANE) {
 		pix_fmt = v4l2_codec_to_driver(inst, f->fmt.pix_mp.pixelformat, __func__);
@@ -2352,10 +2240,6 @@ int msm_vdec_s_fmt(struct msm_vidc_inst *inst, struct v4l2_format *f)
 	u32 codec_align;
 	enum msm_vidc_colorformat_type colorformat;
 
-	if (!inst || !inst->core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
 	core = inst->core;
 	msm_vdec_try_fmt(inst, f);
 
@@ -2528,11 +2412,6 @@ int msm_vdec_g_fmt(struct msm_vidc_inst *inst, struct v4l2_format *f)
 	int rc = 0;
 	int port;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	port = v4l2_type_to_driver_port(inst, f->type, __func__);
 	if (port < 0)
 		return -EINVAL;
@@ -2544,20 +2423,12 @@ int msm_vdec_g_fmt(struct msm_vidc_inst *inst, struct v4l2_format *f)
 
 int msm_vdec_s_selection(struct msm_vidc_inst* inst, struct v4l2_selection* s)
 {
-	if (!inst || !s) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
 	i_vpr_e(inst, "%s: unsupported\n", __func__);
 	return -EINVAL;
 }
 
 int msm_vdec_g_selection(struct msm_vidc_inst* inst, struct v4l2_selection* s)
 {
-	if (!inst || !s) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
 	if (s->type != OUTPUT_MPLANE && s->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) {
 		i_vpr_e(inst, "%s: invalid type %d\n", __func__, s->type);
 		return -EINVAL;
@@ -2592,11 +2463,6 @@ int msm_vdec_subscribe_event(struct msm_vidc_inst *inst,
 {
 	int rc = 0;
 
-	if (!inst || !sub) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	switch (sub->type) {
 	case V4L2_EVENT_EOS:
 		rc = v4l2_event_subscribe(&inst->event_handler, sub, MAX_EVENTS, NULL);
@@ -2653,8 +2519,7 @@ int msm_vdec_enum_fmt(struct msm_vidc_inst *inst, struct v4l2_fmtdesc *f)
 	u32 array[32] = {0};
 	u32 i = 0;
 
-	if (!inst || !inst->core || !f ||
-		f->index >= ARRAY_SIZE(array)) {
+	if (f->index >= ARRAY_SIZE(array)) {
 		d_vpr_e("%s: invalid params\n", __func__);
 		return -EINVAL;
 	}
@@ -2726,10 +2591,6 @@ int msm_vdec_inst_init(struct msm_vidc_inst *inst)
 	struct v4l2_format *f;
 	enum msm_vidc_colorformat_type colorformat;
 
-	if (!inst || !inst->core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
 	core = inst->core;
 
 	INIT_DELAYED_WORK(&inst->decode_batch.work, msm_vidc_batch_handler);
@@ -2826,10 +2687,6 @@ int msm_vdec_inst_deinit(struct msm_vidc_inst *inst)
 {
 	int rc = 0;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
 	/* cancel pending batch work */
 	cancel_batch_work(inst);
 	rc = msm_vidc_ctrl_handler_deinit(inst);

+ 1 - 139
driver/vidc/src/msm_venc.c

@@ -471,11 +471,6 @@ static int msm_venc_set_input_properties(struct msm_vidc_inst *inst)
 		{HFI_PROP_SIGNAL_COLOR_INFO,          msm_venc_set_colorspace                  },
 	};
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	i_vpr_h(inst, "%s()\n", __func__);
 	for (i = 0; i < ARRAY_SIZE(msm_venc_input_set_prop); i++) {
 		/* set session input properties */
@@ -507,11 +502,6 @@ static int msm_venc_set_output_properties(struct msm_vidc_inst *inst)
 		{HFI_PROP_CSC,                        msm_venc_set_csc                     },
 	};
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	i_vpr_h(inst, "%s()\n", __func__);
 	for (i = 0; i < ARRAY_SIZE(msm_venc_output_set_prop); i++) {
 		/* set session output properties */
@@ -538,10 +528,6 @@ static int msm_venc_set_internal_properties(struct msm_vidc_inst *inst)
 {
 	int rc = 0;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
 	i_vpr_h(inst, "%s()\n", __func__);
 
 	rc = msm_venc_set_quality_mode(inst);
@@ -621,11 +607,6 @@ static int msm_venc_create_input_internal_buffers(struct msm_vidc_inst *inst)
 {
 	int i, rc = 0;
 
-	if (!inst || !inst->core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	for (i = 0; i < ARRAY_SIZE(msm_venc_input_internal_buffer_type); i++) {
 		rc = msm_vidc_create_internal_buffers(inst,
 			msm_venc_input_internal_buffer_type[i]);
@@ -640,11 +621,6 @@ static int msm_venc_queue_input_internal_buffers(struct msm_vidc_inst *inst)
 {
 	int i, rc = 0;
 
-	if (!inst || !inst->core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	for (i = 0; i < ARRAY_SIZE(msm_venc_input_internal_buffer_type); i++) {
 		rc = msm_vidc_queue_internal_buffers(inst,
 			msm_venc_input_internal_buffer_type[i]);
@@ -659,11 +635,6 @@ static int msm_venc_get_output_internal_buffers(struct msm_vidc_inst *inst)
 {
 	int i, rc = 0;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	for (i = 0; i < ARRAY_SIZE(msm_venc_output_internal_buffer_type); i++) {
 		rc = msm_vidc_get_internal_buffers(inst,
 			msm_venc_output_internal_buffer_type[i]);
@@ -678,11 +649,6 @@ static int msm_venc_create_output_internal_buffers(struct msm_vidc_inst *inst)
 {
 	int i, rc = 0;
 
-	if (!inst || !inst->core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	for (i = 0; i < ARRAY_SIZE(msm_venc_output_internal_buffer_type); i++) {
 		rc = msm_vidc_create_internal_buffers(inst,
 			msm_venc_output_internal_buffer_type[i]);
@@ -697,11 +663,6 @@ static int msm_venc_queue_output_internal_buffers(struct msm_vidc_inst *inst)
 {
 	int i, rc = 0;
 
-	if (!inst || !inst->core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	for (i = 0; i < ARRAY_SIZE(msm_venc_output_internal_buffer_type); i++) {
 		rc = msm_vidc_queue_internal_buffers(inst,
 			msm_venc_output_internal_buffer_type[i]);
@@ -720,10 +681,6 @@ static int msm_venc_property_subscription(struct msm_vidc_inst *inst,
 	u32 i;
 	u32 payload_size = 0;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
 	i_vpr_h(inst, "%s()\n", __func__);
 
 	payload[0] = HFI_MODE_PROPERTY;
@@ -761,10 +718,6 @@ static int msm_venc_metadata_delivery(struct msm_vidc_inst *inst,
 	u32 payload[32] = {0};
 	u32 i, count = 0;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
 	i_vpr_h(inst, "%s()\n", __func__);
 
 	payload[0] = HFI_MODE_METADATA;
@@ -819,10 +772,6 @@ static int msm_venc_dynamic_metadata_delivery(struct msm_vidc_inst *inst,
 	u32 payload[32] = {0};
 	u32 i, count = 0;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
 	i_vpr_h(inst, "%s()\n", __func__);
 
 	payload[0] = HFI_MODE_DYNAMIC_METADATA;
@@ -864,10 +813,6 @@ static int msm_venc_metadata_subscription(struct msm_vidc_inst *inst,
 	u32 payload[32] = {0};
 	u32 i, count = 0;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
 	i_vpr_h(inst, "%s()\n", __func__);
 
 	payload[0] = HFI_MODE_METADATA;
@@ -919,11 +864,6 @@ int msm_venc_streamoff_input(struct msm_vidc_inst *inst)
 {
 	int rc = 0;
 
-	if (!inst || !inst->core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	rc = msm_vidc_session_streamoff(inst, INPUT_PORT);
 	if (rc)
 		return rc;
@@ -935,11 +875,6 @@ int msm_venc_streamon_input(struct msm_vidc_inst *inst)
 {
 	int rc = 0;
 
-	if (!inst || !inst->core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	if (is_input_meta_enabled(inst) &&
 		!inst->bufq[INPUT_META_PORT].vb2q->streaming) {
 		i_vpr_e(inst,
@@ -1007,11 +942,6 @@ int msm_venc_qbuf(struct msm_vidc_inst *inst, struct vb2_buffer *vb2)
 {
 	int rc = 0;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	rc = msm_vidc_queue_buffer_single(inst, vb2);
 	if (rc)
 		return rc;
@@ -1062,11 +992,6 @@ int msm_venc_streamoff_output(struct msm_vidc_inst *inst)
 	int rc = 0;
 	struct msm_vidc_core *core;
 
-	if (!inst || !inst->core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	core = inst->core;
 
 	/* restore LAYER_COUNT max allowed value */
@@ -1084,11 +1009,6 @@ int msm_venc_streamon_output(struct msm_vidc_inst *inst)
 {
 	int rc = 0;
 
-	if (!inst || !inst->core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	if (is_output_meta_enabled(inst) &&
 		!inst->bufq[OUTPUT_META_PORT].vb2q->streaming) {
 		i_vpr_e(inst,
@@ -1151,11 +1071,6 @@ int msm_venc_try_fmt(struct msm_vidc_inst *inst, struct v4l2_format *f)
 	struct v4l2_pix_format_mplane *pixmp = &f->fmt.pix_mp;
 	u32 pix_fmt;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	memset(pixmp->reserved, 0, sizeof(pixmp->reserved));
 
 	if (f->type == INPUT_MPLANE) {
@@ -1203,10 +1118,6 @@ int msm_venc_s_fmt_output(struct msm_vidc_inst *inst, struct v4l2_format *f)
 	u32 width, height;
 	enum msm_vidc_codec_type codec;
 
-	if (!inst || !inst->core || !f) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
 	core = inst->core;
 	msm_venc_try_fmt(inst, f);
 
@@ -1284,10 +1195,6 @@ static int msm_venc_s_fmt_output_meta(struct msm_vidc_inst *inst, struct v4l2_fo
 	struct v4l2_format *fmt;
 	struct msm_vidc_core *core;
 
-	if (!inst || !inst->core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
 	core = inst->core;
 
 	fmt = &inst->fmts[OUTPUT_META_PORT];
@@ -1321,10 +1228,6 @@ static int msm_venc_s_fmt_input(struct msm_vidc_inst *inst, struct v4l2_format *
 	struct msm_vidc_core *core;
 	u32 pix_fmt, width, height, size, bytesperline;
 
-	if (!inst || !inst->core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
 	core = inst->core;
 	msm_venc_try_fmt(inst, f);
 
@@ -1424,10 +1327,6 @@ static int msm_venc_s_fmt_input_meta(struct msm_vidc_inst *inst, struct v4l2_for
 	struct v4l2_format *fmt;
 	struct msm_vidc_core *core;
 
-	if (!inst || !inst->core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
 	core = inst->core;
 
 	fmt = &inst->fmts[INPUT_META_PORT];
@@ -1458,11 +1357,6 @@ int msm_venc_s_fmt(struct msm_vidc_inst *inst, struct v4l2_format *f)
 {
 	int rc = 0;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	if (f->type == INPUT_MPLANE) {
 		rc = msm_venc_s_fmt_input(inst, f);
 		if (rc)
@@ -1497,11 +1391,6 @@ int msm_venc_g_fmt(struct msm_vidc_inst *inst, struct v4l2_format *f)
 	int rc = 0;
 	int port;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	port = v4l2_type_to_driver_port(inst, f->type, __func__);
 	if (port < 0)
 		return -EINVAL;
@@ -1516,10 +1405,6 @@ int msm_venc_s_selection(struct msm_vidc_inst* inst, struct v4l2_selection* s)
 	int rc = 0;
 	struct v4l2_format *output_fmt;
 
-	if (!inst || !s) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
 	if (s->type != INPUT_MPLANE && s->type != V4L2_BUF_TYPE_VIDEO_OUTPUT) {
 		i_vpr_e(inst, "%s: invalid type %d\n", __func__, s->type);
 		return -EINVAL;
@@ -1622,10 +1507,6 @@ int msm_venc_g_selection(struct msm_vidc_inst* inst, struct v4l2_selection* s)
 {
 	int rc = 0;
 
-	if (!inst || !s) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
 	if (s->type != INPUT_MPLANE && s->type != V4L2_BUF_TYPE_VIDEO_OUTPUT) {
 		i_vpr_e(inst, "%s: invalid type %d\n", __func__, s->type);
 		return -EINVAL;
@@ -1671,11 +1552,6 @@ int msm_venc_s_param(struct msm_vidc_inst *inst,
 	u32 input_rate, default_rate;
 	bool is_frame_rate = false;
 
-	if (!inst || !s_parm) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	if (s_parm->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) {
 		/* operating rate */
 		timeperframe = &s_parm->parm.output.timeperframe;
@@ -1774,11 +1650,6 @@ int msm_venc_g_param(struct msm_vidc_inst *inst,
 {
 	struct v4l2_fract *timeperframe = NULL;
 
-	if (!inst || !s_parm) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	if (s_parm->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) {
 		timeperframe = &s_parm->parm.output.timeperframe;
 		timeperframe->numerator = 1;
@@ -1834,8 +1705,7 @@ int msm_venc_enum_fmt(struct msm_vidc_inst *inst, struct v4l2_fmtdesc *f)
 	u32 array[32] = {0};
 	u32 i = 0;
 
-	if (!inst || !inst->core || !f ||
-	    f->index >= ARRAY_SIZE(array)) {
+	if (f->index >= ARRAY_SIZE(array)) {
 		d_vpr_e("%s: invalid params\n", __func__);
 		return -EINVAL;
 	}
@@ -1907,10 +1777,6 @@ int msm_venc_inst_init(struct msm_vidc_inst *inst)
 	struct v4l2_format *f;
 	enum msm_vidc_colorformat_type colorformat;
 
-	if (!inst || !inst->core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
 	i_vpr_h(inst, "%s()\n", __func__);
 
 	core = inst->core;
@@ -2011,10 +1877,6 @@ int msm_venc_inst_deinit(struct msm_vidc_inst *inst)
 {
 	int rc = 0;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
 	rc = msm_vidc_ctrl_handler_deinit(inst);
 	if (rc)
 		return rc;

+ 37 - 216
driver/vidc/src/msm_vidc.c

@@ -49,7 +49,7 @@ static int get_poll_flags(struct msm_vidc_inst *inst, u32 port)
 	struct vb2_buffer *vb = NULL;
 	unsigned long flags = 0;
 
-	if (!inst || port >= MAX_PORT) {
+	if (port >= MAX_PORT) {
 		d_vpr_e("%s: invalid params, inst %pK, port %d\n",
 			__func__, inst, port);
 		return poll;
@@ -72,16 +72,11 @@ static int get_poll_flags(struct msm_vidc_inst *inst, u32 port)
 	return poll;
 }
 
-int msm_vidc_poll(void *instance, struct file *filp,
+int msm_vidc_poll(struct msm_vidc_inst *inst, struct file *filp,
 		struct poll_table_struct *wait)
 {
 	int poll = 0;
-	struct msm_vidc_inst *inst = instance;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return POLLERR;
-	}
 	if (is_session_error(inst)) {
 		i_vpr_e(inst, "%s: inst in error state\n", __func__);
 		return POLLERR;
@@ -103,17 +98,9 @@ int msm_vidc_poll(void *instance, struct file *filp,
 
 	return poll;
 }
-EXPORT_SYMBOL(msm_vidc_poll);
 
-int msm_vidc_querycap(void *instance, struct v4l2_capability *cap)
+int msm_vidc_querycap(struct msm_vidc_inst *inst, struct v4l2_capability *cap)
 {
-	struct msm_vidc_inst *inst = instance;
-
-	if (!inst || !cap) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	strlcpy(cap->driver, MSM_VIDC_DRV_NAME, sizeof(cap->driver));
 	strlcpy(cap->bus_info, MSM_VIDC_BUS_NAME, sizeof(cap->bus_info));
 	cap->version = MSM_VIDC_VERSION;
@@ -129,17 +116,9 @@ int msm_vidc_querycap(void *instance, struct v4l2_capability *cap)
 
 	return 0;
 }
-EXPORT_SYMBOL(msm_vidc_querycap);
 
-int msm_vidc_enum_fmt(void *instance, struct v4l2_fmtdesc *f)
+int msm_vidc_enum_fmt(struct msm_vidc_inst *inst, struct v4l2_fmtdesc *f)
 {
-	struct msm_vidc_inst *inst = instance;
-
-	if (!inst || !f) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	if (inst->domain == MSM_VIDC_DECODER)
 		return msm_vdec_enum_fmt(inst, f);
 	if (inst->domain == MSM_VIDC_ENCODER)
@@ -147,20 +126,12 @@ int msm_vidc_enum_fmt(void *instance, struct v4l2_fmtdesc *f)
 
 	return -EINVAL;
 }
-EXPORT_SYMBOL(msm_vidc_enum_fmt);
 
-int msm_vidc_query_ctrl(void *instance, struct v4l2_queryctrl *q_ctrl)
+int msm_vidc_query_ctrl(struct msm_vidc_inst *inst, struct v4l2_queryctrl *q_ctrl)
 {
 	int rc = 0;
-	struct msm_vidc_inst *inst = instance;
 	struct v4l2_ctrl *ctrl;
 
-	if (!inst || !q_ctrl) {
-		d_vpr_e("%s: invalid params %pK %pK\n",
-			__func__, inst, q_ctrl);
-		return -EINVAL;
-	}
-
 	ctrl = v4l2_ctrl_find(&inst->ctrl_handler, q_ctrl->id);
 	if (!ctrl) {
 		i_vpr_e(inst, "%s: get_ctrl failed for id %d\n",
@@ -178,20 +149,12 @@ int msm_vidc_query_ctrl(void *instance, struct v4l2_queryctrl *q_ctrl)
 		q_ctrl->default_value, q_ctrl->step, q_ctrl->flags);
 	return rc;
 }
-EXPORT_SYMBOL(msm_vidc_query_ctrl);
 
-int msm_vidc_query_menu(void *instance, struct v4l2_querymenu *qmenu)
+int msm_vidc_query_menu(struct msm_vidc_inst *inst, struct v4l2_querymenu *qmenu)
 {
 	int rc = 0;
-	struct msm_vidc_inst *inst = instance;
 	struct v4l2_ctrl *ctrl;
 
-	if (!inst || !qmenu) {
-		d_vpr_e("%s: invalid params %pK %pK\n",
-			__func__, inst, qmenu);
-		return -EINVAL;
-	}
-
 	ctrl = v4l2_ctrl_find(&inst->ctrl_handler, qmenu->id);
 	if (!ctrl) {
 		i_vpr_e(inst, "%s: get_ctrl failed for id %d\n",
@@ -216,17 +179,10 @@ int msm_vidc_query_menu(void *instance, struct v4l2_querymenu *qmenu)
 		rc ? "not supported" : "supported");
 	return rc;
 }
-EXPORT_SYMBOL(msm_vidc_query_menu);
 
-int msm_vidc_try_fmt(void *instance, struct v4l2_format *f)
+int msm_vidc_try_fmt(struct msm_vidc_inst *inst, struct v4l2_format *f)
 {
 	int rc = 0;
-	struct msm_vidc_inst *inst = instance;
-
-	if (!inst || !f) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
 
 	if (inst->domain == MSM_VIDC_DECODER)
 		rc = msm_vdec_try_fmt(inst, f);
@@ -238,17 +194,10 @@ int msm_vidc_try_fmt(void *instance, struct v4l2_format *f)
 			__func__, f->type, rc);
 	return rc;
 }
-EXPORT_SYMBOL(msm_vidc_try_fmt);
 
-int msm_vidc_s_fmt(void *instance, struct v4l2_format *f)
+int msm_vidc_s_fmt(struct msm_vidc_inst *inst, struct v4l2_format *f)
 {
 	int rc = 0;
-	struct msm_vidc_inst *inst = instance;
-
-	if (!inst || !f) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
 
 	if (inst->domain == MSM_VIDC_DECODER)
 		rc = msm_vdec_s_fmt(inst, f);
@@ -260,17 +209,10 @@ int msm_vidc_s_fmt(void *instance, struct v4l2_format *f)
 			__func__, f->type, rc);
 	return rc;
 }
-EXPORT_SYMBOL(msm_vidc_s_fmt);
 
-int msm_vidc_g_fmt(void *instance, struct v4l2_format *f)
+int msm_vidc_g_fmt(struct msm_vidc_inst *inst, struct v4l2_format *f)
 {
 	int rc = 0;
-	struct msm_vidc_inst *inst = instance;
-
-	if (!inst || !f) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
 
 	if (is_decode_session(inst))
 		rc = msm_vdec_g_fmt(inst, f);
@@ -291,17 +233,10 @@ int msm_vidc_g_fmt(void *instance, struct v4l2_format *f)
 
 	return 0;
 }
-EXPORT_SYMBOL(msm_vidc_g_fmt);
 
-int msm_vidc_s_selection(void *instance, struct v4l2_selection *s)
+int msm_vidc_s_selection(struct msm_vidc_inst *inst, struct v4l2_selection *s)
 {
 	int rc = 0;
-	struct msm_vidc_inst *inst = instance;
-
-	if (!inst || !s) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
 
 	if (is_decode_session(inst))
 		rc = msm_vdec_s_selection(inst, s);
@@ -310,17 +245,10 @@ int msm_vidc_s_selection(void *instance, struct v4l2_selection *s)
 
 	return rc;
 }
-EXPORT_SYMBOL(msm_vidc_s_selection);
 
-int msm_vidc_g_selection(void *instance, struct v4l2_selection *s)
+int msm_vidc_g_selection(struct msm_vidc_inst *inst, struct v4l2_selection *s)
 {
 	int rc = 0;
-	struct msm_vidc_inst *inst = instance;
-
-	if (!inst || !s) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
 
 	if (is_decode_session(inst))
 		rc = msm_vdec_g_selection(inst, s);
@@ -329,24 +257,17 @@ int msm_vidc_g_selection(void *instance, struct v4l2_selection *s)
 
 	return rc;
 }
-EXPORT_SYMBOL(msm_vidc_g_selection);
 
-int msm_vidc_s_param(void *instance, struct v4l2_streamparm *param)
+int msm_vidc_s_param(struct msm_vidc_inst *inst, struct v4l2_streamparm *param)
 {
 	int rc = 0;
-	struct msm_vidc_inst *inst = instance;
-
-	if (!inst || !param) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
 
 	if (param->type != V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE &&
 		param->type != V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE)
 		return -EINVAL;
 
 	if (is_encode_session(inst)) {
-		rc = msm_venc_s_param(instance, param);
+		rc = msm_venc_s_param(inst, param);
 	} else {
 		i_vpr_e(inst, "%s: invalid domain %#x\n",
 			__func__, inst->domain);
@@ -355,24 +276,17 @@ int msm_vidc_s_param(void *instance, struct v4l2_streamparm *param)
 
 	return rc;
 }
-EXPORT_SYMBOL(msm_vidc_s_param);
 
-int msm_vidc_g_param(void *instance, struct v4l2_streamparm *param)
+int msm_vidc_g_param(struct msm_vidc_inst *inst, struct v4l2_streamparm *param)
 {
 	int rc = 0;
-	struct msm_vidc_inst *inst = instance;
-
-	if (!inst || !param) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
 
 	if (param->type != V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE &&
 		param->type != V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE)
 		return -EINVAL;
 
 	if (is_encode_session(inst)) {
-		rc = msm_venc_g_param(instance, param);
+		rc = msm_venc_g_param(inst, param);
 	} else {
 		i_vpr_e(inst, "%s: invalid domain %#x\n",
 			__func__, inst->domain);
@@ -381,19 +295,12 @@ int msm_vidc_g_param(void *instance, struct v4l2_streamparm *param)
 
 	return rc;
 }
-EXPORT_SYMBOL(msm_vidc_g_param);
 
-int msm_vidc_reqbufs(void *instance, struct v4l2_requestbuffers *b)
+int msm_vidc_reqbufs(struct msm_vidc_inst *inst, struct v4l2_requestbuffers *b)
 {
 	int rc = 0;
-	struct msm_vidc_inst *inst = instance;
 	int port;
 
-	if (!inst || !b) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	port = v4l2_type_to_driver_port(inst, b->type, __func__);
 	if (port < 0) {
 		rc = -EINVAL;
@@ -410,19 +317,12 @@ int msm_vidc_reqbufs(void *instance, struct v4l2_requestbuffers *b)
 exit:
 	return rc;
 }
-EXPORT_SYMBOL(msm_vidc_reqbufs);
 
-int msm_vidc_querybuf(void *instance, struct v4l2_buffer *b)
+int msm_vidc_querybuf(struct msm_vidc_inst *inst, struct v4l2_buffer *b)
 {
 	int rc = 0;
-	struct msm_vidc_inst *inst = instance;
 	int port;
 
-	if (!inst || !b) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	port = v4l2_type_to_driver_port(inst, b->type, __func__);
 	if (port < 0) {
 		rc = -EINVAL;
@@ -439,20 +339,13 @@ int msm_vidc_querybuf(void *instance, struct v4l2_buffer *b)
 exit:
 	return rc;
 }
-EXPORT_SYMBOL(msm_vidc_querybuf);
 
-int msm_vidc_create_bufs(void *instance, struct v4l2_create_buffers *b)
+int msm_vidc_create_bufs(struct msm_vidc_inst *inst, struct v4l2_create_buffers *b)
 {
 	int rc = 0;
-	struct msm_vidc_inst *inst = instance;
 	int port;
 	struct v4l2_format *f;
 
-	if (!inst || !b) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	f = &b->format;
 	port = v4l2_type_to_driver_port(inst, f->type, __func__);
 	if (port < 0) {
@@ -470,16 +363,14 @@ int msm_vidc_create_bufs(void *instance, struct v4l2_create_buffers *b)
 exit:
 	return rc;
 }
-EXPORT_SYMBOL(msm_vidc_create_bufs);
 
-int msm_vidc_prepare_buf(void *instance, struct media_device *mdev,
+int msm_vidc_prepare_buf(struct msm_vidc_inst *inst, struct media_device *mdev,
 	struct v4l2_buffer *b)
 {
 	int rc = 0;
-	struct msm_vidc_inst *inst = instance;
 	struct vb2_queue *q;
 
-	if (!inst || !inst->core || !b || !valid_v4l2_buffer(b, inst)) {
+	if (!valid_v4l2_buffer(b, inst)) {
 		d_vpr_e("%s: invalid params %pK %pK\n", __func__, inst, b);
 		return -EINVAL;
 	}
@@ -499,16 +390,14 @@ int msm_vidc_prepare_buf(void *instance, struct media_device *mdev,
 exit:
 	return rc;
 }
-EXPORT_SYMBOL(msm_vidc_prepare_buf);
 
-int msm_vidc_qbuf(void *instance, struct media_device *mdev,
+int msm_vidc_qbuf(struct msm_vidc_inst *inst, struct media_device *mdev,
 		struct v4l2_buffer *b)
 {
 	int rc = 0;
-	struct msm_vidc_inst *inst = instance;
 	struct vb2_queue *q;
 
-	if (!inst || !inst->core || !b || !valid_v4l2_buffer(b, inst)) {
+	if (!valid_v4l2_buffer(b, inst)) {
 		d_vpr_e("%s: invalid params %pK %pK\n", __func__, inst, b);
 		return -EINVAL;
 	}
@@ -526,15 +415,13 @@ int msm_vidc_qbuf(void *instance, struct media_device *mdev,
 exit:
 	return rc;
 }
-EXPORT_SYMBOL(msm_vidc_qbuf);
 
-int msm_vidc_dqbuf(void *instance, struct v4l2_buffer *b)
+int msm_vidc_dqbuf(struct msm_vidc_inst *inst, struct v4l2_buffer *b)
 {
 	int rc = 0;
-	struct msm_vidc_inst *inst = instance;
 	struct vb2_queue *q;
 
-	if (!inst || !b || !valid_v4l2_buffer(b, inst)) {
+	if (!valid_v4l2_buffer(b, inst)) {
 		d_vpr_e("%s: invalid params %pK %pK\n", __func__, inst, b);
 		return -EINVAL;
 	}
@@ -556,19 +443,12 @@ int msm_vidc_dqbuf(void *instance, struct v4l2_buffer *b)
 exit:
 	return rc;
 }
-EXPORT_SYMBOL(msm_vidc_dqbuf);
 
-int msm_vidc_streamon(void *instance, enum v4l2_buf_type type)
+int msm_vidc_streamon(struct msm_vidc_inst *inst, enum v4l2_buf_type type)
 {
 	int rc = 0;
-	struct msm_vidc_inst *inst = instance;
 	int port;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	port = v4l2_type_to_driver_port(inst, type, __func__);
 	if (port < 0) {
 		rc = -EINVAL;
@@ -585,19 +465,12 @@ int msm_vidc_streamon(void *instance, enum v4l2_buf_type type)
 exit:
 	return rc;
 }
-EXPORT_SYMBOL(msm_vidc_streamon);
 
-int msm_vidc_streamoff(void *instance, enum v4l2_buf_type type)
+int msm_vidc_streamoff(struct msm_vidc_inst *inst, enum v4l2_buf_type type)
 {
 	int rc = 0;
-	struct msm_vidc_inst *inst = instance;
 	int port;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	port = v4l2_type_to_driver_port(inst, type, __func__);
 	if (port < 0) {
 		rc = -EINVAL;
@@ -614,12 +487,10 @@ int msm_vidc_streamoff(void *instance, enum v4l2_buf_type type)
 exit:
 	return rc;
 }
-EXPORT_SYMBOL(msm_vidc_streamoff);
 
-int msm_vidc_try_cmd(void *instance, union msm_v4l2_cmd *cmd)
+int msm_vidc_try_cmd(struct msm_vidc_inst *inst, union msm_v4l2_cmd *cmd)
 {
 	int rc = 0;
-	struct msm_vidc_inst *inst = instance;
 	struct v4l2_decoder_cmd *dec = NULL;
 	struct v4l2_encoder_cmd *enc = NULL;
 
@@ -645,11 +516,9 @@ int msm_vidc_try_cmd(void *instance, union msm_v4l2_cmd *cmd)
 
 	return rc;
 }
-EXPORT_SYMBOL(msm_vidc_try_cmd);
 
-int msm_vidc_start_cmd(void *instance)
+int msm_vidc_start_cmd(struct msm_vidc_inst *inst)
 {
-	struct msm_vidc_inst *inst = instance;
 	int rc = 0;
 
 	if (!is_decode_session(inst) && !is_encode_session(inst)) {
@@ -669,11 +538,9 @@ int msm_vidc_start_cmd(void *instance)
 
 	return rc;
 }
-EXPORT_SYMBOL(msm_vidc_start_cmd);
 
-int msm_vidc_stop_cmd(void *instance)
+int msm_vidc_stop_cmd(struct msm_vidc_inst *inst)
 {
-	struct msm_vidc_inst *inst = instance;
 	int rc = 0;
 
 	if (!is_decode_session(inst) && !is_encode_session(inst)) {
@@ -693,21 +560,13 @@ int msm_vidc_stop_cmd(void *instance)
 
 	return rc;
 }
-EXPORT_SYMBOL(msm_vidc_stop_cmd);
 
-int msm_vidc_enum_framesizes(void *instance, struct v4l2_frmsizeenum *fsize)
+int msm_vidc_enum_framesizes(struct msm_vidc_inst *inst, struct v4l2_frmsizeenum *fsize)
 {
-	struct msm_vidc_inst *inst = instance;
 	enum msm_vidc_colorformat_type colorfmt;
 	enum msm_vidc_codec_type codec;
 	u32 meta_fmt;
 
-	if (!inst || !fsize) {
-		d_vpr_e("%s: invalid params: %pK %pK\n",
-				__func__, inst, fsize);
-		return -EINVAL;
-	}
-
 	/* only index 0 allowed as per v4l2 spec */
 	if (fsize->index)
 		return -EINVAL;
@@ -739,22 +598,14 @@ int msm_vidc_enum_framesizes(void *instance, struct v4l2_frmsizeenum *fsize)
 
 	return 0;
 }
-EXPORT_SYMBOL(msm_vidc_enum_framesizes);
 
-int msm_vidc_enum_frameintervals(void *instance, struct v4l2_frmivalenum *fival)
+int msm_vidc_enum_frameintervals(struct msm_vidc_inst *inst, struct v4l2_frmivalenum *fival)
 {
-	struct msm_vidc_inst *inst = instance;
 	struct msm_vidc_core *core;
 	enum msm_vidc_colorformat_type colorfmt;
 	u32 fps, mbpf;
 	u32 meta_fmt;
 
-	if (!inst || !fival) {
-		d_vpr_e("%s: invalid params: %pK %pK\n",
-				__func__, inst, fival);
-		return -EINVAL;
-	}
-
 	if (is_decode_session(inst)) {
 		i_vpr_e(inst, "%s: not supported by decoder\n", __func__);
 		return -ENOTTY;
@@ -803,18 +654,11 @@ int msm_vidc_enum_frameintervals(void *instance, struct v4l2_frmivalenum *fival)
 
 	return 0;
 }
-EXPORT_SYMBOL(msm_vidc_enum_frameintervals);
 
-int msm_vidc_subscribe_event(void *instance,
+int msm_vidc_subscribe_event(struct msm_vidc_inst *inst,
 		const struct v4l2_event_subscription *sub)
 {
 	int rc = 0;
-	struct msm_vidc_inst *inst = (struct msm_vidc_inst *)instance;
-
-	if (!inst || !sub) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
 
 	i_vpr_h(inst, "%s: type %d id %d\n", __func__, sub->type, sub->id);
 
@@ -825,18 +669,12 @@ int msm_vidc_subscribe_event(void *instance,
 
 	return rc;
 }
-EXPORT_SYMBOL(msm_vidc_subscribe_event);
 
-int msm_vidc_unsubscribe_event(void *instance,
+int msm_vidc_unsubscribe_event(struct msm_vidc_inst *inst,
 		const struct v4l2_event_subscription *sub)
 {
 	int rc = 0;
-	struct msm_vidc_inst *inst = (struct msm_vidc_inst *)instance;
 
-	if (!inst || !sub) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
 	i_vpr_h(inst, "%s: type %d id %d\n", __func__, sub->type, sub->id);
 	rc = v4l2_event_unsubscribe(&inst->event_handler, sub);
 	if (rc)
@@ -844,33 +682,24 @@ int msm_vidc_unsubscribe_event(void *instance,
 			 __func__, sub->type, sub->id);
 	return rc;
 }
-EXPORT_SYMBOL(msm_vidc_unsubscribe_event);
 
-int msm_vidc_dqevent(void *instance, struct v4l2_event *event)
+int msm_vidc_dqevent(struct msm_vidc_inst *inst, struct v4l2_event *event)
 {
 	int rc = 0;
-	struct msm_vidc_inst *inst = (struct msm_vidc_inst *)instance;
 
-	if (!inst || !event) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
 	rc = v4l2_event_dequeue(&inst->event_handler, event, false);
 	if (rc)
 		i_vpr_e(inst, "%s: fialed\n", __func__);
 	return rc;
 }
-EXPORT_SYMBOL(msm_vidc_dqevent);
 
-void *msm_vidc_open(void *vidc_core, u32 session_type)
+void *msm_vidc_open(struct msm_vidc_core *core, u32 session_type)
 {
 	int rc = 0;
 	struct msm_vidc_inst *inst = NULL;
-	struct msm_vidc_core *core;
 	int i = 0;
 
 	d_vpr_h("%s: %s\n", __func__, video_banner);
-	core = vidc_core;
 	if (!core) {
 		d_vpr_e("%s: invalid params\n", __func__);
 		return NULL;
@@ -1036,19 +865,12 @@ fail_add_session:
 	msm_vidc_vmem_free((void **)&inst);
 	return NULL;
 }
-EXPORT_SYMBOL(msm_vidc_open);
 
-int msm_vidc_close(void *instance)
+int msm_vidc_close(struct msm_vidc_inst *inst)
 {
 	int rc = 0;
-	struct msm_vidc_inst *inst = instance;
 	struct msm_vidc_core *core;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	core = inst->core;
 
 	i_vpr_h(inst, "%s()\n", __func__);
@@ -1072,5 +894,4 @@ int msm_vidc_close(void *instance)
 	msm_vidc_schedule_core_deinit(core);
 
 	return rc;
-}
-EXPORT_SYMBOL(msm_vidc_close);
+}

+ 0 - 43
driver/vidc/src/msm_vidc_buffer.c

@@ -18,11 +18,6 @@ u32 msm_vidc_input_min_count(struct msm_vidc_inst* inst)
 	u32 input_min_count = 0;
 	u32 hb_enh_layer = 0;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return 0;
-	}
-
 	if (is_decode_session(inst)) {
 		input_min_count = MIN_DEC_INPUT_BUFFERS;
 	} else if (is_encode_session(inst)) {
@@ -53,11 +48,6 @@ u32 msm_vidc_output_min_count(struct msm_vidc_inst *inst)
 {
 	u32 output_min_count;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return 0;
-	}
-
 	if (!is_decode_session(inst) && !is_encode_session(inst))
 		return 0;
 
@@ -98,10 +88,6 @@ u32 msm_vidc_input_extra_count(struct msm_vidc_inst *inst)
 	u32 count = 0;
 	struct msm_vidc_core *core;
 
-	if (!inst || !inst->core) {
-		d_vpr_e("%s: invalid params %pK\n", __func__, inst);
-		return 0;
-	}
 	core = inst->core;
 
 	/*
@@ -137,10 +123,6 @@ u32 msm_vidc_output_extra_count(struct msm_vidc_inst *inst)
 	u32 count = 0;
 	struct msm_vidc_core *core;
 
-	if (!inst || !inst->core) {
-		d_vpr_e("%s: invalid params %pK\n", __func__, inst);
-		return 0;
-	}
 	core = inst->core;
 
 	/*
@@ -173,11 +155,6 @@ u32 msm_vidc_internal_buffer_count(struct msm_vidc_inst *inst,
 {
 	u32 count = 0;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return 0;
-	}
-
 	if (is_encode_session(inst))
 		return 1;
 
@@ -215,11 +192,6 @@ u32 msm_vidc_decoder_input_size(struct msm_vidc_inst *inst)
 	u32 bitstream_size_overwrite = 0;
 	enum msm_vidc_codec_type codec;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return 0;
-	}
-
 	bitstream_size_overwrite =
 		inst->capabilities[BITSTREAM_SIZE_OVERWRITE].value;
 	if (bitstream_size_overwrite) {
@@ -329,11 +301,6 @@ u32 msm_vidc_enc_delivery_mode_based_output_buf_size(struct msm_vidc_inst *inst,
 	u32 total_mb_count;
 	struct v4l2_format *f;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return frame_size;
-	}
-
 	f = &inst->fmts[OUTPUT_PORT];
 
 	if (f->fmt.pix_mp.pixelformat != V4L2_PIX_FMT_HEVC &&
@@ -368,11 +335,6 @@ u32 msm_vidc_encoder_output_size(struct msm_vidc_inst *inst)
 	struct v4l2_format *f;
 	enum msm_vidc_codec_type codec;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return 0;
-	}
-
 	f = &inst->fmts[OUTPUT_PORT];
 	codec = v4l2_codec_to_driver(inst, f->fmt.pix_mp.pixelformat, __func__);
 	/*
@@ -442,11 +404,6 @@ u32 msm_vidc_encoder_input_meta_size(struct msm_vidc_inst *inst)
 	struct v4l2_format *f;
 	u32 width, height;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return 0;
-	}
-
 	size = MSM_VIDC_METADATA_SIZE;
 
 	if (inst->capabilities[META_ROI_INFO].value) {

+ 0 - 48
driver/vidc/src/msm_vidc_control.c

@@ -155,8 +155,6 @@ bool is_valid_cap_id(enum msm_vidc_inst_capability_type cap_id)
 bool is_valid_cap(struct msm_vidc_inst *inst,
 		enum msm_vidc_inst_capability_type cap_id)
 {
-	if (!inst)
-		return false;
 	if (cap_id <= INST_CAP_NONE || cap_id >= INST_CAP_MAX)
 		return false;
 
@@ -332,10 +330,6 @@ static int msm_vidc_adjust_dynamic_property(struct msm_vidc_inst *inst,
 	s32 prev_value;
 	int rc = 0;
 
-	if (!inst || !ctrl) {
-		d_vpr_e("%s: invalid param\n", __func__);
-		return -EINVAL;
-	}
 	cap = &inst->capabilities[0];
 
 	/* sanitize cap_id */
@@ -440,10 +434,6 @@ static int msm_vidc_set_dynamic_property(struct msm_vidc_inst *inst)
 	struct msm_vidc_inst_cap_entry *entry = NULL, *temp = NULL;
 	int rc = 0;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
 	i_vpr_h(inst, "%s()\n", __func__);
 
 	list_for_each_entry_safe(entry, temp, &inst->firmware_list, list) {
@@ -468,10 +458,6 @@ error:
 
 int msm_vidc_ctrl_handler_deinit(struct msm_vidc_inst *inst)
 {
-	if (!inst) {
-		d_vpr_e("%s: invalid parameters\n", __func__);
-		return -EINVAL;
-	}
 	i_vpr_h(inst, "%s(): num ctrls %d\n", __func__, inst->num_ctrls);
 	v4l2_ctrl_handler_free(&inst->ctrl_handler);
 	memset(&inst->ctrl_handler, 0, sizeof(struct v4l2_ctrl_handler));
@@ -489,10 +475,6 @@ int msm_vidc_ctrl_handler_init(struct msm_vidc_inst *inst, bool init)
 	int num_ctrls = 0, ctrl_idx = 0;
 	u64 codecs_count, step_or_mask;
 
-	if (!inst || !inst->core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
 	core = inst->core;
 	cap = &inst->capabilities[0];
 
@@ -676,11 +658,6 @@ static int msm_vidc_update_buffer_count_if_needed(struct msm_vidc_inst* inst,
 	int rc = 0;
 	bool update_input_port = false, update_output_port = false;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid parameters\n", __func__);
-		return -EINVAL;
-	}
-
 	switch (cap_id) {
 	case LAYER_TYPE:
 	case ENH_LAYER_COUNT:
@@ -719,10 +696,6 @@ static int msm_vidc_allow_secure_session(struct msm_vidc_inst *inst)
 	struct msm_vidc_core *core;
 	u32 count = 0;
 
-	if (!inst || !inst->core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
 	core = inst->core;
 
 	core_lock(core, __func__);
@@ -786,11 +759,6 @@ static int msm_vidc_update_static_property(struct msm_vidc_inst *inst,
 {
 	int rc = 0;
 
-	if (!inst || !ctrl) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	if (cap_id == DRV_VERSION) {
 		i_vpr_h(inst, "%s: driver version update not allowed\n",
 			__func__);
@@ -879,10 +847,6 @@ int msm_vidc_s_ctrl(struct msm_vidc_inst *inst, struct v4l2_ctrl *ctrl)
 	int rc = 0;
 	u32 port;
 
-	if (!inst || !ctrl) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
 	cap = &inst->capabilities[0];
 
 	i_vpr_h(inst, FMT_STRING_SET_CTRL,
@@ -969,10 +933,6 @@ int msm_vidc_prepare_dependency_list(struct msm_vidc_inst *inst)
 	int tmp_count_total, tmp_count, num_nodes = 0;
 	int i, rc = 0;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
 	cap = &inst->capabilities[0];
 
 	if (!list_empty(&inst->caps_list)) {
@@ -1084,10 +1044,6 @@ int msm_vidc_adjust_v4l2_properties(struct msm_vidc_inst *inst)
 	struct msm_vidc_inst_cap_entry *entry = NULL, *temp = NULL;
 	int rc = 0;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
 	i_vpr_h(inst, "%s()\n", __func__);
 
 	/* adjust all possible caps from caps_list */
@@ -1108,10 +1064,6 @@ int msm_vidc_set_v4l2_properties(struct msm_vidc_inst *inst)
 	struct msm_vidc_inst_cap_entry *entry = NULL, *temp = NULL;
 	int rc = 0;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
 	i_vpr_h(inst, "%s()\n", __func__);
 
 	/* set all caps from caps_list */

+ 26 - 44
driver/vidc/src/msm_vidc_debug.c

@@ -173,48 +173,42 @@ struct core_inst_pair {
 };
 
 /* debug fs support */
-static inline void tic(struct msm_vidc_inst *i, enum profiling_points p,
+static inline void tic(struct msm_vidc_inst *inst, enum profiling_points p,
 				 char *b)
 {
-	if (!i->debug.pdata[p].name[0])
-		memcpy(i->debug.pdata[p].name, b, 64);
-	if (i->debug.pdata[p].sampling) {
-		i->debug.pdata[p].start = ktime_get_ns() / 1000 / 1000;
-		i->debug.pdata[p].sampling = false;
+	if (!inst->debug.pdata[p].name[0])
+		memcpy(inst->debug.pdata[p].name, b, 64);
+	if (inst->debug.pdata[p].sampling) {
+		inst->debug.pdata[p].start = ktime_get_ns() / 1000 / 1000;
+		inst->debug.pdata[p].sampling = false;
 	}
 }
 
-static inline void toc(struct msm_vidc_inst *i, enum profiling_points p)
+static inline void toc(struct msm_vidc_inst *inst, enum profiling_points p)
 {
-	if (!i->debug.pdata[p].sampling) {
-		i->debug.pdata[p].stop = ktime_get_ns() / 1000 / 1000;
-		i->debug.pdata[p].cumulative += i->debug.pdata[p].stop -
-			i->debug.pdata[p].start;
-		i->debug.pdata[p].sampling = true;
+	if (!inst->debug.pdata[p].sampling) {
+		inst->debug.pdata[p].stop = ktime_get_ns() / 1000 / 1000;
+		inst->debug.pdata[p].cumulative += inst->debug.pdata[p].stop -
+			inst->debug.pdata[p].start;
+		inst->debug.pdata[p].sampling = true;
 	}
 }
 
-void msm_vidc_show_stats(void *inst)
+void msm_vidc_show_stats(struct msm_vidc_inst *inst)
 {
 	int x;
-	struct msm_vidc_inst *i = (struct msm_vidc_inst *) inst;
-
-	if (!i) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return;
-	}
 
 	for (x = 0; x < MAX_PROFILING_POINTS; x++) {
-		if (i->debug.pdata[x].name[0]) {
-			if (i->debug.samples) {
-				i_vpr_p(i, "%s averaged %llu ms/sample\n",
-						i->debug.pdata[x].name,
-						i->debug.pdata[x].cumulative /
-						i->debug.samples);
+		if (inst->debug.pdata[x].name[0]) {
+			if (inst->debug.samples) {
+				i_vpr_p(inst, "%s averaged %llu ms/sample\n",
+						inst->debug.pdata[x].name,
+						inst->debug.pdata[x].cumulative /
+						inst->debug.samples);
 			}
 
-			i_vpr_p(i, "%s Samples: %d\n",
-				i->debug.pdata[x].name, i->debug.samples);
+			i_vpr_p(inst, "%s Samples: %d\n",
+				inst->debug.pdata[x].name, inst->debug.samples);
 		}
 	}
 }
@@ -438,11 +432,10 @@ failed_create_dir:
 	return NULL;
 }
 
-struct dentry *msm_vidc_debugfs_init_core(void *core_in)
+struct dentry *msm_vidc_debugfs_init_core(struct msm_vidc_core *core)
 {
 	struct dentry *dir = NULL;
 	char debugfs_name[MAX_DEBUGFS_NAME];
-	struct msm_vidc_core *core = (struct msm_vidc_core *) core_in;
 	struct dentry *parent;
 
 	if (!core || !core->debugfs_parent) {
@@ -592,17 +585,12 @@ static const struct file_operations inst_info_fops = {
 	.release = inst_info_release,
 };
 
-struct dentry *msm_vidc_debugfs_init_inst(void *instance, struct dentry *parent)
+struct dentry *msm_vidc_debugfs_init_inst(struct msm_vidc_inst *inst, struct dentry *parent)
 {
 	struct dentry *dir = NULL, *info = NULL;
 	char debugfs_name[MAX_DEBUGFS_NAME];
 	struct core_inst_pair *idata = NULL;
-	struct msm_vidc_inst *inst = (struct msm_vidc_inst *) instance;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		goto exit;
-	}
 	snprintf(debugfs_name, MAX_DEBUGFS_NAME, "inst_%d", inst->session_id);
 
 	if (msm_vidc_vmem_alloc(sizeof(struct core_inst_pair), (void **)&idata, __func__))
@@ -641,12 +629,11 @@ exit:
 	return dir;
 }
 
-void msm_vidc_debugfs_deinit_inst(void *instance)
+void msm_vidc_debugfs_deinit_inst(struct msm_vidc_inst *inst)
 {
 	struct dentry *dentry = NULL;
-	struct msm_vidc_inst *inst = (struct msm_vidc_inst *) instance;
 
-	if (!inst || !inst->debugfs_root)
+	if (!inst->debugfs_root)
 		return;
 
 	dentry = inst->debugfs_root;
@@ -660,17 +647,12 @@ void msm_vidc_debugfs_deinit_inst(void *instance)
 	inst->debugfs_root = NULL;
 }
 
-void msm_vidc_debugfs_update(void *instance,
+void msm_vidc_debugfs_update(struct msm_vidc_inst *inst,
 	enum msm_vidc_debugfs_event e)
 {
-	struct msm_vidc_inst *inst = (struct msm_vidc_inst *) instance;
 	struct msm_vidc_debug *d;
 	char a[64] = "Frame processing";
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return;
-	}
 	d = &inst->debug;
 
 	switch (e) {

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 4 - 411
driver/vidc/src/msm_vidc_driver.c


+ 0 - 34
driver/vidc/src/msm_vidc_fence.c

@@ -53,11 +53,6 @@ struct msm_vidc_fence *msm_vidc_fence_create(struct msm_vidc_inst *inst)
 	struct msm_vidc_fence *fence = NULL;
 	int rc = 0;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return NULL;
-	}
-
 	rc = msm_vidc_vmem_alloc(sizeof(*fence), (void **)&fence, __func__);
 	if (rc)
 		return NULL;
@@ -88,11 +83,6 @@ int msm_vidc_dma_fence_create_fd(struct msm_vidc_inst *inst,
 {
 	int rc = 0;
 
-	if (!inst || !fence) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	fence->fd = get_unused_fd_flags(0);
 	if (fence->fd < 0) {
 		i_vpr_e(inst, "%s: getting fd (%d) failed\n", __func__,
@@ -125,11 +115,6 @@ static struct msm_vidc_fence *msm_vidc_get_dma_fence_from_id(
 	struct msm_vidc_fence *fence, *dummy_fence;
 	bool found = false;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return NULL;
-	}
-
 	list_for_each_entry_safe(fence, dummy_fence, &inst->fence_list, list) {
 		if (fence->fence_id == fence_id) {
 			found = true;
@@ -151,11 +136,6 @@ static int msm_vidc_fence_signal(struct msm_vidc_inst *inst, u64 fence_id)
 	int rc = 0;
 	struct msm_vidc_fence *fence;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	fence = msm_vidc_get_dma_fence_from_id(inst, fence_id);
 	if (!fence) {
 		i_vpr_e(inst, "%s: no fence available to signal with id: %u\n",
@@ -179,11 +159,6 @@ static void msm_vidc_fence_destroy(struct msm_vidc_inst *inst, u64 fence_id)
 {
 	struct msm_vidc_fence *fence;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return;
-	}
-
 	fence = msm_vidc_get_dma_fence_from_id(inst, fence_id);
 	if (!fence) {
 		return;
@@ -200,11 +175,6 @@ int msm_vidc_fence_init(struct msm_vidc_inst *inst)
 {
 	int rc = 0;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	inst->fence_context.ctx_num = dma_fence_context_alloc(1);
 	snprintf(inst->fence_context.name, sizeof(inst->fence_context.name),
 		"msm_vidc_fence: %s: %llu", inst->debug_str,
@@ -216,10 +186,6 @@ int msm_vidc_fence_init(struct msm_vidc_inst *inst)
 
 void msm_vidc_fence_deinit(struct msm_vidc_inst *inst)
 {
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return;
-	}
 	i_vpr_h(inst, "%s: %s\n", __func__, inst->fence_context.name);
 	inst->fence_context.ctx_num = 0;
 	snprintf(inst->fence_context.name, sizeof(inst->fence_context.name),

+ 5 - 20
driver/vidc/src/msm_vidc_memory.c

@@ -69,7 +69,7 @@ void *msm_vidc_pool_alloc(struct msm_vidc_inst *inst, enum msm_memory_pool_type
 	struct msm_memory_alloc_header *hdr = NULL;
 	struct msm_memory_pool *pool;
 
-	if (!inst || type < 0 || type >= MSM_MEM_POOL_MAX) {
+	if (type < 0 || type >= MSM_MEM_POOL_MAX) {
 		d_vpr_e("%s: Invalid params\n", __func__);
 		return NULL;
 	}
@@ -110,7 +110,7 @@ void msm_vidc_pool_free(struct msm_vidc_inst *inst, void *vidc_buf)
 	struct msm_memory_alloc_header *hdr;
 	struct msm_memory_pool *pool;
 
-	if (!inst || !vidc_buf) {
+	if (!vidc_buf) {
 		d_vpr_e("%s: Invalid params\n", __func__);
 		return;
 	}
@@ -148,7 +148,7 @@ static void msm_vidc_destroy_pool_buffers(struct msm_vidc_inst *inst,
 	struct msm_memory_pool *pool;
 	u32 fcount = 0, bcount = 0;
 
-	if (!inst || type < 0 || type >= MSM_MEM_POOL_MAX) {
+	if (type < 0 || type >= MSM_MEM_POOL_MAX) {
 		d_vpr_e("%s: Invalid params\n", __func__);
 		return;
 	}
@@ -181,11 +181,6 @@ int msm_vidc_pools_init(struct msm_vidc_inst *inst)
 {
 	u32 i;
 
-	if (!inst) {
-		d_vpr_e("%s: Invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	if (ARRAY_SIZE(buftype_size_name_arr) != MSM_MEM_POOL_MAX) {
 		i_vpr_e(inst, "%s: num elements mismatch %lu %u\n", __func__,
 			ARRAY_SIZE(buftype_size_name_arr), MSM_MEM_POOL_MAX);
@@ -211,11 +206,6 @@ void msm_vidc_pools_deinit(struct msm_vidc_inst *inst)
 {
 	u32 i = 0;
 
-	if (!inst) {
-		d_vpr_e("%s: Invalid params\n", __func__);
-		return;
-	}
-
 	/* destroy all buffers from all pool types */
 	for (i = 0; i < MSM_MEM_POOL_MAX; i++)
 		msm_vidc_destroy_pool_buffers(inst, i);
@@ -227,11 +217,6 @@ static struct dma_buf *msm_vidc_dma_buf_get(struct msm_vidc_inst *inst, int fd)
 	struct dma_buf *dmabuf = NULL;
 	bool found = false;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return NULL;
-	}
-
 	/* get local dmabuf ref for tracking */
 	dmabuf = dma_buf_get(fd);
 	if (IS_ERR_OR_NULL(dmabuf)) {
@@ -277,7 +262,7 @@ static void msm_vidc_dma_buf_put(struct msm_vidc_inst *inst, struct dma_buf *dma
 	struct msm_memory_dmabuf *buf = NULL;
 	bool found = false;
 
-	if (!inst || !dmabuf) {
+	if (!dmabuf) {
 		d_vpr_e("%s: invalid params\n", __func__);
 		return;
 	}
@@ -312,7 +297,7 @@ static void msm_vidc_dma_buf_put(struct msm_vidc_inst *inst, struct dma_buf *dma
 static void msm_vidc_dma_buf_put_completely(struct msm_vidc_inst *inst,
 	struct msm_memory_dmabuf *buf)
 {
-	if (!inst || !buf) {
+	if (!buf) {
 		d_vpr_e("%s: invalid params\n", __func__);
 		return;
 	}

+ 0 - 38
driver/vidc/src/msm_vidc_power.c

@@ -94,10 +94,6 @@ u64 msm_vidc_max_freq(struct msm_vidc_inst *inst)
 	struct frequency_table *freq_tbl;
 	u64 freq = 0;
 
-	if (!inst || !inst->core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return freq;
-	}
 	core = inst->core;
 
 	if (!core->resource || !core->resource->freq_set.freq_tbl ||
@@ -166,10 +162,6 @@ static int msm_vidc_set_buses(struct msm_vidc_inst* inst)
 	u64 total_bw_ddr = 0, total_bw_llcc = 0;
 	u64 curr_time_ns;
 
-	if (!inst || !inst->core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
 	core = inst->core;
 
 	mutex_lock(&core->lock);
@@ -221,10 +213,6 @@ int msm_vidc_scale_buses(struct msm_vidc_inst *inst)
 	struct v4l2_format *inp_f;
 	u32 operating_rate, frame_rate;
 
-	if (!inst || !inst->core) {
-		d_vpr_e("%s: invalid params: %pK\n", __func__, inst);
-		return -EINVAL;
-	}
 	core = inst->core;
 	if (!core->resource) {
 		i_vpr_e(inst, "%s: invalid resource params\n", __func__);
@@ -348,10 +336,6 @@ int msm_vidc_set_clocks(struct msm_vidc_inst* inst)
 	u64 curr_time_ns;
 	int i = 0;
 
-	if (!inst || !inst->core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
 	core = inst->core;
 
 	if (!core->resource || !core->resource->freq_set.freq_tbl ||
@@ -428,11 +412,6 @@ static int msm_vidc_apply_dcvs(struct msm_vidc_inst *inst)
 	int bufs_with_fw = 0;
 	struct msm_vidc_power *power;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params %pK\n", __func__, inst);
-		return -EINVAL;
-	}
-
 	/* skip dcvs */
 	if (!inst->power.dcvs_mode)
 		return 0;
@@ -503,10 +482,6 @@ int msm_vidc_scale_clocks(struct msm_vidc_inst *inst)
 {
 	struct msm_vidc_core* core;
 
-	if (!inst || !inst->core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
 	core = inst->core;
 
 	if (inst->power.buffer_counter < DCVS_WINDOW ||
@@ -539,10 +514,6 @@ int msm_vidc_scale_power(struct msm_vidc_inst *inst, bool scale_buses)
 	u32 frame_rate, operating_rate;
 	u32 timestamp_rate = 0, input_rate = 0;
 
-	if (!inst || !inst->core) {
-		d_vpr_e("%s: invalid params %pK\n", __func__, inst);
-		return -EINVAL;
-	}
 	core = inst->core;
 
 	if (!inst->active) {
@@ -637,11 +608,6 @@ void msm_vidc_dcvs_data_reset(struct msm_vidc_inst *inst)
 	struct msm_vidc_power *dcvs;
 	u32 min_count, actual_count, max_count;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return;
-	}
-
 	dcvs = &inst->power;
 	if (is_encode_session(inst)) {
 		min_count = inst->buffers.input.min_count;
@@ -673,10 +639,6 @@ void msm_vidc_power_data_reset(struct msm_vidc_inst *inst)
 {
 	int rc = 0;
 
-	if (!inst || !inst->core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return;
-	}
 	i_vpr_hp(inst, "%s\n", __func__);
 
 	msm_vidc_dcvs_data_reset(inst);

+ 0 - 45
driver/vidc/src/msm_vidc_state.c

@@ -659,11 +659,6 @@ static int msm_vidc_open_state(struct msm_vidc_inst *inst,
 {
 	int rc = 0;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	/* inst must be locked */
 	rc = __strict_inst_check(inst, __func__);
 	if (rc) {
@@ -769,11 +764,6 @@ static int msm_vidc_input_streaming_state(struct msm_vidc_inst *inst,
 {
 	int rc = 0;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	/* inst must be locked */
 	rc = __strict_inst_check(inst, __func__);
 	if (rc) {
@@ -971,11 +961,6 @@ static int msm_vidc_output_streaming_state(struct msm_vidc_inst *inst,
 {
 	int rc = 0;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	/* inst must be locked */
 	rc = __strict_inst_check(inst, __func__);
 	if (rc) {
@@ -1165,11 +1150,6 @@ static int msm_vidc_streaming_state(struct msm_vidc_inst *inst,
 {
 	int rc = 0;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	/* inst must be locked */
 	rc = __strict_inst_check(inst, __func__);
 	if (rc) {
@@ -1286,11 +1266,6 @@ static int msm_vidc_close_state(struct msm_vidc_inst *inst,
 {
 	int rc = 0;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	/* inst must be locked */
 	rc = __strict_inst_check(inst, __func__);
 	if (rc) {
@@ -1322,11 +1297,6 @@ static int msm_vidc_error_state(struct msm_vidc_inst *inst,
 {
 	int rc = 0;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	/* inst must be locked */
 	rc = __strict_inst_check(inst, __func__);
 	if (rc) {
@@ -1424,11 +1394,6 @@ int msm_vidc_change_state(struct msm_vidc_inst *inst,
 	enum msm_vidc_allow allow;
 	int rc;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	if (is_session_error(inst)) {
 		i_vpr_h(inst,
 			"%s: inst is in bad state, can not change state to %s\n",
@@ -1513,11 +1478,6 @@ static int msm_vidc_set_sub_state(struct msm_vidc_inst *inst,
 								   MSM_VIDC_OUTPUT_PAUSE         },
 	};
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	/* no substate to update */
 	if (!sub_state)
 		return 0;
@@ -1592,11 +1552,6 @@ int msm_vidc_change_sub_state(struct msm_vidc_inst *inst,
 	enum msm_vidc_sub_state prev_sub_state;
 	int rc = 0;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	if (is_session_error(inst)) {
 		i_vpr_h(inst,
 			"%s: inst is in bad state, can not change sub state\n", func);

+ 0 - 29
driver/vidc/src/msm_vidc_synx.c

@@ -78,11 +78,6 @@ static struct msm_vidc_fence *msm_vidc_get_synx_fence_from_id(
 	struct msm_vidc_fence *fence, *dummy_fence;
 	bool found = false;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return NULL;
-	}
-
 	list_for_each_entry_safe(fence, dummy_fence, &inst->fence_list, list) {
 		if (fence->fence_id == fence_id) {
 			found = true;
@@ -103,11 +98,6 @@ static void msm_vidc_synx_fence_destroy(struct msm_vidc_inst *inst, u64 fence_id
 {
 	struct msm_vidc_fence *fence;
 
-	if (!inst || !inst->core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return;
-	}
-
 	fence = msm_vidc_get_synx_fence_from_id(inst, fence_id);
 	if (!fence) {
 		return;
@@ -200,11 +190,6 @@ static struct msm_vidc_fence *msm_vidc_synx_dma_fence_create(struct msm_vidc_ins
 	struct msm_vidc_fence *fence = NULL;
 	int rc = 0;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return NULL;
-	}
-
 	rc = msm_vidc_vmem_alloc(sizeof(*fence), (void **)&fence, __func__);
 	if (rc)
 		return NULL;
@@ -234,10 +219,6 @@ static struct msm_vidc_fence *msm_vidc_synx_fence_create(struct msm_vidc_inst *i
 	struct synx_create_params params;
 	u32 fence_id = 0;
 
-	if (!inst || !inst->core || !fence) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return NULL;
-	}
 	core = inst->core;
 
 	/* return if synx fence is not supported */
@@ -291,11 +272,6 @@ int msm_vidc_synx_fence_create_fd(struct msm_vidc_inst *inst,
 {
 	int rc = 0;
 
-	if (!inst || !fence) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	fence->fd = get_unused_fd_flags(0);
 	if (fence->fd < 0) {
 		i_vpr_e(inst, "%s: getting fd (%d) failed\n", __func__,
@@ -328,11 +304,6 @@ static int msm_vidc_synx_fence_signal(struct msm_vidc_inst *inst, u64 fence_id)
 	struct msm_vidc_fence *fence;
 	struct msm_vidc_core *core;
 
-	if (!inst || !inst->core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	core = inst->core;
 
 	fence = msm_vidc_get_synx_fence_from_id(inst, fence_id);

+ 49 - 27
driver/vidc/src/msm_vidc_v4l2.c

@@ -25,9 +25,23 @@ static struct msm_vidc_inst *get_vidc_inst(struct file *filp, void *fh)
 
 unsigned int msm_v4l2_poll(struct file *filp, struct poll_table_struct *pt)
 {
+	int poll = 0;
 	struct msm_vidc_inst *inst = get_vidc_inst(filp, NULL);
 
-	return msm_vidc_poll((void *)inst, filp, pt);
+	inst = get_inst_ref(g_core, inst);
+	if (!inst) {
+		d_vpr_e("%s: invalid instance\n", __func__);
+		return POLLERR;
+	}
+
+	poll = msm_vidc_poll((void *)inst, filp, pt);
+	if (poll) {
+		goto exit;
+	}
+
+exit:
+	put_inst(inst);
+	return poll;
 }
 
 int msm_v4l2_open(struct file *filp)
@@ -57,6 +71,11 @@ int msm_v4l2_close(struct file *filp)
 	struct msm_vidc_inst *inst;
 
 	inst = get_vidc_inst(filp, NULL);
+	if (!inst) {
+		d_vpr_e("%s: invalid instance\n", __func__);
+		return -EINVAL;
+	}
+
 	trace_msm_v4l2_vidc_close("START", inst);
 
 	rc = msm_vidc_close(inst);
@@ -72,7 +91,7 @@ int msm_v4l2_querycap(struct file *filp, void *fh,
 	int rc = 0;
 
 	inst = get_inst_ref(g_core, inst);
-	if (!inst) {
+	if (!inst || !cap) {
 		d_vpr_e("%s: invalid instance\n", __func__);
 		return -EINVAL;
 	}
@@ -98,7 +117,7 @@ int msm_v4l2_enum_fmt(struct file *filp, void *fh,
 	int rc = 0;
 
 	inst = get_inst_ref(g_core, inst);
-	if (!inst) {
+	if (!inst || !f) {
 		d_vpr_e("%s: invalid instance\n", __func__);
 		return -EINVAL;
 	}
@@ -123,7 +142,7 @@ int msm_v4l2_try_fmt(struct file *filp, void *fh, struct v4l2_format *f)
 	int rc = 0;
 
 	inst = get_inst_ref(g_core, inst);
-	if (!inst) {
+	if (!inst || !f) {
 		d_vpr_e("%s: invalid instance\n", __func__);
 		return -EINVAL;
 	}
@@ -154,7 +173,7 @@ int msm_v4l2_s_fmt(struct file *filp, void *fh,
 	int rc = 0;
 
 	inst = get_inst_ref(g_core, inst);
-	if (!inst) {
+	if (!inst || !f) {
 		d_vpr_e("%s: invalid instance\n", __func__);
 		return -EINVAL;
 	}
@@ -185,7 +204,7 @@ int msm_v4l2_g_fmt(struct file *filp, void *fh,
 	int rc = 0;
 
 	inst = get_inst_ref(g_core, inst);
-	if (!inst) {
+	if (!inst || !f) {
 		d_vpr_e("%s: invalid instance\n", __func__);
 		return -EINVAL;
 	}
@@ -211,7 +230,7 @@ int msm_v4l2_s_selection(struct file *filp, void *fh,
 	int rc = 0;
 
 	inst = get_inst_ref(g_core, inst);
-	if (!inst) {
+	if (!inst || !s) {
 		d_vpr_e("%s: invalid instance\n", __func__);
 		return -EINVAL;
 	}
@@ -242,7 +261,7 @@ int msm_v4l2_g_selection(struct file *filp, void *fh,
 	int rc = 0;
 
 	inst = get_inst_ref(g_core, inst);
-	if (!inst) {
+	if (!inst || !s) {
 		d_vpr_e("%s: invalid instance\n", __func__);
 		return -EINVAL;
 	}
@@ -268,7 +287,7 @@ int msm_v4l2_s_parm(struct file *filp, void *fh,
 	int rc = 0;
 
 	inst = get_inst_ref(g_core, inst);
-	if (!inst) {
+	if (!inst || !a) {
 		d_vpr_e("%s: invalid instance\n", __func__);
 		return -EINVAL;
 	}
@@ -299,7 +318,7 @@ int msm_v4l2_g_parm(struct file *filp, void *fh,
 	int rc = 0;
 
 	inst = get_inst_ref(g_core, inst);
-	if (!inst) {
+	if (!inst || !a) {
 		d_vpr_e("%s: invalid instance\n", __func__);
 		return -EINVAL;
 	}
@@ -325,7 +344,7 @@ int msm_v4l2_reqbufs(struct file *filp, void *fh,
 	int rc = 0;
 
 	inst = get_inst_ref(g_core, inst);
-	if (!inst) {
+	if (!inst || !b) {
 		d_vpr_e("%s: invalid instance\n", __func__);
 		return -EINVAL;
 	}
@@ -351,7 +370,7 @@ int msm_v4l2_querybuf(struct file *filp, void *fh,
 	int rc = 0;
 
 	inst = get_inst_ref(g_core, inst);
-	if (!inst) {
+	if (!inst || !b) {
 		d_vpr_e("%s: invalid instance\n", __func__);
 		return -EINVAL;
 	}
@@ -377,7 +396,7 @@ int msm_v4l2_create_bufs(struct file *filp, void *fh,
 	int rc = 0;
 
 	inst = get_inst_ref(g_core, inst);
-	if (!inst) {
+	if (!inst || !b) {
 		d_vpr_e("%s: invalid instance\n", __func__);
 		return -EINVAL;
 	}
@@ -404,7 +423,7 @@ int msm_v4l2_prepare_buf(struct file *filp, void *fh,
 	int rc = 0;
 
 	inst = get_inst_ref(g_core, inst);
-	if (!inst) {
+	if (!inst || !b) {
 		d_vpr_e("%s: invalid instance\n", __func__);
 		return -EINVAL;
 	}
@@ -431,7 +450,7 @@ int msm_v4l2_qbuf(struct file *filp, void *fh,
 	int rc = 0;
 
 	inst = get_inst_ref(g_core, inst);
-	if (!inst) {
+	if (!inst || !b) {
 		d_vpr_e("%s: invalid instance\n", __func__);
 		return -EINVAL;
 	}
@@ -461,7 +480,7 @@ int msm_v4l2_dqbuf(struct file *filp, void *fh,
 	int rc = 0;
 
 	inst = get_inst_ref(g_core, inst);
-	if (!inst) {
+	if (!inst || !b) {
 		d_vpr_e("%s: invalid instance\n", __func__);
 		return -EINVAL;
 	}
@@ -535,7 +554,7 @@ int msm_v4l2_subscribe_event(struct v4l2_fh *fh,
 
 	inst = container_of(fh, struct msm_vidc_inst, event_handler);
 	inst = get_inst_ref(g_core, inst);
-	if (!inst) {
+	if (!inst || !sub) {
 		d_vpr_e("%s: invalid instance\n", __func__);
 		return -EINVAL;
 	}
@@ -567,7 +586,7 @@ int msm_v4l2_unsubscribe_event(struct v4l2_fh *fh,
 
 	inst = container_of(fh, struct msm_vidc_inst, event_handler);
 	inst = get_inst_ref(g_core, inst);
-	if (!inst) {
+	if (!inst || !sub) {
 		d_vpr_e("%s: invalid instance\n", __func__);
 		return -EINVAL;
 	}
@@ -593,7 +612,7 @@ int msm_v4l2_try_decoder_cmd(struct file *filp, void *fh,
 	int rc = 0;
 
 	inst = get_inst_ref(g_core, inst);
-	if (!inst) {
+	if (!inst || !dec) {
 		d_vpr_e("%s: invalid instance\n", __func__);
 		return -EINVAL;
 	}
@@ -668,7 +687,7 @@ int msm_v4l2_try_encoder_cmd(struct file *filp, void *fh,
 	int rc = 0;
 
 	inst = get_inst_ref(g_core, inst);
-	if (!inst) {
+	if (!inst || !enc) {
 		d_vpr_e("%s: invalid instance\n", __func__);
 		return -EINVAL;
 	}
@@ -743,8 +762,9 @@ int msm_v4l2_enum_framesizes(struct file *filp, void *fh,
 	int rc = 0;
 
 	inst = get_inst_ref(g_core, inst);
-	if (!inst) {
-		d_vpr_e("%s: invalid instance\n", __func__);
+	if (!inst || !fsize) {
+		d_vpr_e("%s: invalid params: %pK %pK\n",
+				__func__, inst, fsize);
 		return -EINVAL;
 	}
 
@@ -769,8 +789,9 @@ int msm_v4l2_enum_frameintervals(struct file *filp, void *fh,
 	int rc = 0;
 
 	inst = get_inst_ref(g_core, inst);
-	if (!inst) {
-		d_vpr_e("%s: invalid instance\n", __func__);
+	if (!inst || !fival) {
+		d_vpr_e("%s: invalid params: %pK %pK\n",
+			__func__, inst, fival);
 		return -EINVAL;
 	}
 
@@ -795,7 +816,7 @@ int msm_v4l2_queryctrl(struct file *filp, void *fh,
 	int rc = 0;
 
 	inst = get_inst_ref(g_core, inst);
-	if (!inst) {
+	if (!inst || !ctrl) {
 		d_vpr_e("%s: invalid instance\n", __func__);
 		return -EINVAL;
 	}
@@ -821,8 +842,9 @@ int msm_v4l2_querymenu(struct file *filp, void *fh,
 	int rc = 0;
 
 	inst = get_inst_ref(g_core, inst);
-	if (!inst) {
-		d_vpr_e("%s: invalid instance\n", __func__);
+	if (!inst || !qmenu) {
+		d_vpr_e("%s: invalid params %pK %pK\n",
+			__func__, inst, qmenu);
 		return -EINVAL;
 	}
 

+ 23 - 16
driver/vidc/src/msm_vidc_vb2.c

@@ -23,10 +23,6 @@ struct vb2_queue *msm_vidc_get_vb2q(struct msm_vidc_inst *inst,
 {
 	struct vb2_queue *q = NULL;
 
-	if (!inst) {
-		d_vpr_e("%s: invalid params\n", func);
-		return NULL;
-	}
 	if (type == INPUT_MPLANE) {
 		q = inst->bufq[INPUT_PORT].vb2q;
 	} else if (type == OUTPUT_MPLANE) {
@@ -407,11 +403,6 @@ int msm_vidc_start_streaming(struct msm_vidc_inst *inst, struct vb2_queue *q)
 	enum msm_vidc_buffer_type buf_type;
 	int rc = 0;
 
-	if (!inst || !q) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	if (q->type == INPUT_META_PLANE || q->type == OUTPUT_META_PLANE) {
 		i_vpr_h(inst, "%s: nothing to start on %s\n",
 			__func__, v4l2_type_name(q->type));
@@ -513,11 +504,6 @@ int msm_vidc_stop_streaming(struct msm_vidc_inst *inst, struct vb2_queue *q)
 {
 	int rc = 0;
 
-	if (!inst || !q) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	if (q->type == INPUT_META_PLANE || q->type == OUTPUT_META_PLANE) {
 		i_vpr_h(inst, "%s: nothing to stop on %s\n",
 			__func__, v4l2_type_name(q->type));
@@ -594,6 +580,11 @@ void msm_vb2_buf_queue(struct vb2_buffer *vb2)
 	u64 timestamp_us = 0;
 	u64 ktime_ns = ktime_get_ns();
 
+	if (!vb2) {
+		d_vpr_e("%s: invalid params\n", __func__);
+		return;
+	}
+
 	inst = vb2_get_drv_priv(vb2->vb2_queue);
 	if (!inst) {
 		d_vpr_e("%s: invalid params\n", __func__);
@@ -698,15 +689,31 @@ void msm_vb2_buf_cleanup(struct vb2_buffer *vb)
 
 int msm_vb2_buf_out_validate(struct vb2_buffer *vb)
 {
-	struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
+	struct vb2_v4l2_buffer *vbuf;
+
+	if (!vb) {
+		d_vpr_e("%s: invalid vb\n", __func__);
+		return -EINVAL;
+	}
 
+	vbuf = to_vb2_v4l2_buffer(vb);
 	vbuf->field = V4L2_FIELD_NONE;
 	return 0;
 }
 
 void msm_vb2_request_complete(struct vb2_buffer *vb)
 {
-	struct msm_vidc_inst *inst = vb2_get_drv_priv(vb->vb2_queue);
+	struct msm_vidc_inst *inst;
+
+	if (!vb) {
+		d_vpr_e("%s: invalid vb\n", __func__);
+		return;
+	}
+	inst = vb2_get_drv_priv(vb->vb2_queue);
+	if (!inst) {
+		 d_vpr_e("%s: invalid inst\n", __func__);
+		 return;
+	}
 
 	i_vpr_l(inst, "%s: vb type %d, index %d\n",
 		__func__, vb->type, vb->index);

+ 19 - 31
driver/vidc/src/venus_hfi.c

@@ -67,7 +67,7 @@ static bool __valdiate_session(struct msm_vidc_core *core,
 	struct msm_vidc_inst *temp;
 	int rc = 0;
 
-	if (!core || !inst)
+	if (!core)
 		return false;
 
 	rc = __strict_check(core, __func__);
@@ -1029,7 +1029,7 @@ int venus_hfi_trigger_stability(struct msm_vidc_inst *inst, u32 type,
 	u32 payload[2];
 	int rc = 0;
 
-	if (!inst || !inst->core || !inst->packet) {
+	if (!inst->packet) {
 		d_vpr_e("%s: Invalid params\n", __func__);
 		return -EINVAL;
 	}
@@ -1075,7 +1075,7 @@ int venus_hfi_reserve_hardware(struct msm_vidc_inst *inst, u32 duration)
 	enum hfi_reserve_type payload;
 	int rc = 0;
 
-	if (!inst || !inst->core || !inst->packet) {
+	if (!inst->packet) {
 		d_vpr_e("%s: Invalid params\n", __func__);
 		return -EINVAL;
 	}
@@ -1121,7 +1121,7 @@ int venus_hfi_session_open(struct msm_vidc_inst *inst)
 	int rc = 0;
 	struct msm_vidc_core *core;
 
-	if (!inst || !inst->core || !inst->packet) {
+	if (!inst->packet) {
 		d_vpr_e("%s: invalid params\n", __func__);
 		return -EINVAL;
 	}
@@ -1163,7 +1163,7 @@ int venus_hfi_session_set_codec(struct msm_vidc_inst *inst)
 	struct msm_vidc_core *core;
 	u32 codec;
 
-	if (!inst || !inst->core || !inst->packet) {
+	if (!inst->packet) {
 		d_vpr_e("%s: invalid params\n", __func__);
 		return -EINVAL;
 	}
@@ -1207,7 +1207,7 @@ int venus_hfi_session_set_secure_mode(struct msm_vidc_inst *inst)
 	struct msm_vidc_core *core;
 	u32 secure_mode;
 
-	if (!inst || !inst->core || !inst->packet) {
+	if (!inst->packet) {
 		d_vpr_e("%s: invalid params\n", __func__);
 		return -EINVAL;
 	}
@@ -1252,7 +1252,7 @@ static int venus_hfi_cache_packet(struct msm_vidc_inst *inst)
 	struct hfi_pending_packet *packet;
 	struct msm_vidc_core *core;
 
-	if (!inst || !inst->core || !inst->packet) {
+	if (!inst->packet) {
 		d_vpr_e("%s: invalid params\n", __func__);
 		return -EINVAL;
 	}
@@ -1291,7 +1291,7 @@ int venus_hfi_session_property(struct msm_vidc_inst *inst,
 	int rc = 0;
 	struct msm_vidc_core *core;
 
-	if (!inst || !inst->core || !inst->packet) {
+	if (!inst->packet) {
 		d_vpr_e("%s: invalid params\n", __func__);
 		return -EINVAL;
 	}
@@ -1338,7 +1338,7 @@ int venus_hfi_session_close(struct msm_vidc_inst *inst)
 	int rc = 0;
 	struct msm_vidc_core *core;
 
-	if (!inst || !inst->packet) {
+	if (!inst->packet) {
 		d_vpr_e("%s: invalid params\n", __func__);
 		return -EINVAL;
 	}
@@ -1377,7 +1377,7 @@ int venus_hfi_start(struct msm_vidc_inst *inst, enum msm_vidc_port_type port)
 	int rc = 0;
 	struct msm_vidc_core *core;
 
-	if (!inst || !inst->core || !inst->packet) {
+	if (!inst->packet) {
 		d_vpr_e("%s: invalid params\n", __func__);
 		return -EINVAL;
 	}
@@ -1420,7 +1420,7 @@ int venus_hfi_stop(struct msm_vidc_inst *inst, enum msm_vidc_port_type port)
 	int rc = 0;
 	struct msm_vidc_core *core;
 
-	if (!inst || !inst->core || !inst->packet) {
+	if (!inst->packet) {
 		d_vpr_e("%s: invalid params\n", __func__);
 		return -EINVAL;
 	}
@@ -1464,7 +1464,7 @@ int venus_hfi_session_pause(struct msm_vidc_inst *inst, enum msm_vidc_port_type
 	int rc = 0;
 	struct msm_vidc_core *core;
 
-	if (!inst || !inst->core || !inst->packet) {
+	if (!inst->packet) {
 		d_vpr_e("%s: invalid params\n", __func__);
 		return -EINVAL;
 	}
@@ -1508,7 +1508,7 @@ int venus_hfi_session_resume(struct msm_vidc_inst *inst,
 	int rc = 0;
 	struct msm_vidc_core *core;
 
-	if (!inst || !inst->core || !inst->packet) {
+	if (!inst->packet) {
 		d_vpr_e("%s: invalid params\n", __func__);
 		return -EINVAL;
 	}
@@ -1551,7 +1551,7 @@ int venus_hfi_session_drain(struct msm_vidc_inst *inst, enum msm_vidc_port_type
 	int rc = 0;
 	struct msm_vidc_core *core;
 
-	if (!inst || !inst->core || !inst->packet) {
+	if (!inst->packet) {
 		d_vpr_e("%s: invalid params\n", __func__);
 		return -EINVAL;
 	}
@@ -1597,7 +1597,7 @@ int venus_hfi_session_command(struct msm_vidc_inst *inst,
 	int rc = 0;
 	struct msm_vidc_core *core;
 
-	if (!inst || !inst->core || !inst->packet) {
+	if (!inst->packet) {
 		d_vpr_e("%s: invalid params\n", __func__);
 		return -EINVAL;
 	}
@@ -1646,7 +1646,7 @@ int venus_hfi_queue_super_buffer(struct msm_vidc_inst *inst,
 	u32 frame_size, meta_size, batch_size, cnt = 0;
 	u64 ts_delta_us;
 
-	if (!inst || !inst->core || !inst->packet) {
+	if (!inst->packet) {
 		d_vpr_e("%s: invalid params\n", __func__);
 		return -EINVAL;
 	}
@@ -1766,7 +1766,7 @@ static int venus_hfi_add_pending_packets(struct msm_vidc_inst *inst)
 	struct hfi_packet *src_pkt;
 	struct msm_vidc_core *core;
 
-	if (!inst || !inst->core || !inst->packet) {
+	if (!inst->packet) {
 		d_vpr_e("%s: invalid params\n", __func__);
 		return -EINVAL;
 	}
@@ -1808,7 +1808,7 @@ int venus_hfi_queue_buffer(struct msm_vidc_inst *inst,
 	struct msm_vidc_core *core;
 	struct hfi_buffer hfi_buffer, hfi_meta_buffer;
 
-	if (!inst || !inst->core || !inst->packet) {
+	if (!inst->packet) {
 		d_vpr_e("%s: invalid params\n", __func__);
 		return -EINVAL;
 	}
@@ -1901,7 +1901,7 @@ int venus_hfi_release_buffer(struct msm_vidc_inst *inst,
 	struct msm_vidc_core *core;
 	struct hfi_buffer hfi_buffer;
 
-	if (!inst || !inst->core || !inst->packet || !buffer) {
+	if (!inst->packet || !buffer) {
 		d_vpr_e("%s: invalid params\n", __func__);
 		return -EINVAL;
 	}
@@ -1952,10 +1952,6 @@ int venus_hfi_scale_clocks(struct msm_vidc_inst *inst, u64 freq)
 	int rc = 0;
 	struct msm_vidc_core *core;
 
-	if (!inst || !inst->core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
 	core = inst->core;
 
 	core_lock(core, __func__);
@@ -1979,10 +1975,6 @@ int venus_hfi_scale_buses(struct msm_vidc_inst *inst, u64 bw_ddr, u64 bw_llcc)
 	int rc = 0;
 	struct msm_vidc_core *core;
 
-	if (!inst || !inst->core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
 	core = inst->core;
 
 	core_lock(core, __func__);
@@ -2008,10 +2000,6 @@ int venus_hfi_set_ir_period(struct msm_vidc_inst *inst, u32 ir_type,
 	struct msm_vidc_core *core;
 	u32 ir_period, sync_frame_req = 0;
 
-	if (!inst || !inst->core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
 	core = inst->core;
 
 	core_lock(core, __func__);

+ 0 - 59
driver/vidc/src/venus_hfi_response.c

@@ -45,9 +45,6 @@ struct msm_vidc_hfi_packet_handle {
 void print_psc_properties(const char *str, struct msm_vidc_inst *inst,
 	struct msm_vidc_subscription_params subsc_params)
 {
-	if (!inst || !str)
-		return;
-
 	i_vpr_h(inst,
 		"%s: width %d, height %d, crop offsets[0] %#x, crop offsets[1] %#x, bit depth %#x, coded frames %d "
 		"fw min count %d, poc %d, color info %d, profile %d, level %d, tier %d, fg present %d, sb enabled %d\n",
@@ -132,11 +129,6 @@ u32 vidc_port_from_hfi(struct msm_vidc_inst *inst,
 bool is_valid_hfi_port(struct msm_vidc_inst *inst, u32 port,
 	u32 buffer_type, const char *func)
 {
-	if (!inst) {
-		i_vpr_e(inst, "%s: invalid params\n", func);
-		return false;
-	}
-
 	if (port == HFI_PORT_NONE &&
 		buffer_type != HFI_BUFFER_ARP &&
 		buffer_type != HFI_BUFFER_PERSIST)
@@ -156,11 +148,6 @@ invalid:
 bool is_valid_hfi_buffer_type(struct msm_vidc_inst *inst,
 	u32 buffer_type, const char *func)
 {
-	if (!inst) {
-		i_vpr_e(inst, "%s: invalid params\n", func);
-		return false;
-	}
-
 	if (buffer_type != HFI_BUFFER_BITSTREAM &&
 	    buffer_type != HFI_BUFFER_RAW &&
 	    buffer_type != HFI_BUFFER_METADATA &&
@@ -255,11 +242,6 @@ static bool check_for_packet_payload(struct msm_vidc_inst *inst,
 {
 	u32 payload_size = 0;
 
-	if (!inst || !pkt) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return false;
-	}
-
 	if (pkt->payload_info == HFI_PAYLOAD_NONE) {
 		i_vpr_h(inst, "%s: no playload available for packet %#x\n",
 			func, pkt->type);
@@ -661,10 +643,6 @@ static int handle_read_only_buffer(struct msm_vidc_inst *inst,
 	struct msm_vidc_core *core;
 	bool found = false;
 
-	if (!inst || !inst->core || !buf) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
 	core = inst->core;
 
 	if (!is_decode_session(inst) || !is_output_buffer(buf->type))
@@ -714,11 +692,6 @@ static int handle_non_read_only_buffer(struct msm_vidc_inst *inst,
 {
 	struct msm_vidc_buffer *ro_buf;
 
-	if (!inst || !buffer) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	if (!is_decode_session(inst) || buffer->type != HFI_BUFFER_RAW)
 		return 0;
 
@@ -781,10 +754,6 @@ static int handle_input_buffer(struct msm_vidc_inst *inst,
 	u32 frame_size, batch_size;
 	bool found;
 
-	if (!inst || !buffer || !inst->core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
 	core = inst->core;
 	buffers = msm_vidc_get_buffers(inst, MSM_VIDC_BUF_INPUT, __func__);
 	if (!buffers)
@@ -868,11 +837,6 @@ static int msm_vidc_handle_fence_signal(struct msm_vidc_inst *inst,
 	bool signal_error = false;
 	struct msm_vidc_core *core = inst->core;
 
-	if (!buf) {
-		i_vpr_e(inst, "%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	if (inst->capabilities[OUTBUF_FENCE_TYPE].value ==
 		MSM_VIDC_FENCE_NONE)
 		return 0;
@@ -940,10 +904,6 @@ static int handle_output_buffer(struct msm_vidc_inst *inst,
 	struct msm_vidc_core *core;
 	bool found, fatal = false;
 
-	if (!inst || !inst->core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
 	core = inst->core;
 
 	/* handle drain last flag buffer */
@@ -1109,10 +1069,6 @@ static int handle_input_metadata_buffer(struct msm_vidc_inst *inst,
 	u32 frame_size, batch_size;
 	bool found;
 
-	if (!inst || !buffer || !inst->core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
 	core = inst->core;
 	buffers = msm_vidc_get_buffers(inst, MSM_VIDC_BUF_INPUT_META, __func__);
 	if (!buffers)
@@ -1179,11 +1135,6 @@ static int handle_output_metadata_buffer(struct msm_vidc_inst *inst,
 	struct msm_vidc_buffer *buf;
 	bool found;
 
-	if (!inst) {
-		d_vpr_e("%s: Invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	buffers = msm_vidc_get_buffers(inst, MSM_VIDC_BUF_OUTPUT_META, __func__);
 	if (!buffers)
 		return -EINVAL;
@@ -1891,11 +1842,6 @@ static int handle_session_property(struct msm_vidc_inst *inst,
 	int rc = 0;
 	u32 port;
 
-	if (!inst) {
-		d_vpr_e("%s: Invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	i_vpr_l(inst, "%s: property type %#x\n", __func__, pkt->type);
 
 	port = vidc_port_from_hfi(inst, pkt->port);
@@ -2075,11 +2021,6 @@ static int handle_session_response(struct msm_vidc_core *core,
 	int i, rc = 0;
 	bool found_ipsc = false;
 
-	if (!core || !hdr) {
-		d_vpr_e("%s: Invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	inst = get_inst(core, hdr->session_id);
 	if (!inst) {
 		d_vpr_e("%s: Invalid inst\n", __func__);

برخی فایل ها در این مقایسه diff نمایش داده نمی شوند زیرا تعداد فایل ها بسیار زیاد است