Explorar el Código

video: driver: Remove core check from video driver

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

Change-Id: I5f6374b68dd739b7ab563f32f64bb90e368c4085
Signed-off-by: Vedang Nagar <[email protected]>
Vedang Nagar hace 2 años
padre
commit
e05b1f39c9

+ 0 - 1
driver/platform/common/inc/msm_vidc_platform.h

@@ -265,7 +265,6 @@ struct msm_vidc_platform_data {
 };
 
 struct msm_vidc_platform {
-	void *core;
 	struct msm_vidc_platform_data data;
 };
 

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

@@ -242,11 +242,6 @@ static const struct msm_vidc_compat_handle compat_handle[] = {
 
 static int msm_vidc_init_ops(struct msm_vidc_core *core)
 {
-	if (!core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	d_vpr_h("%s: initialize ops\n", __func__);
 	core->v4l2_file_ops = &msm_v4l2_file_operations;
 	core->v4l2_ioctl_ops_enc = &msm_v4l2_ioctl_ops_enc;
@@ -280,10 +275,6 @@ static int msm_vidc_init_platform_variant(struct msm_vidc_core *core)
 	struct device *dev = NULL;
 	int i, rc = 0;
 
-	if (!core || !core->pdev) {
-		d_vpr_e("%s: Invalid params\n", __func__);
-		return -EINVAL;
-	}
 	dev = &core->pdev->dev;
 
 	d_vpr_h("%s()\n", __func__);
@@ -315,10 +306,6 @@ static int msm_vidc_init_vpu(struct msm_vidc_core *core)
 	struct device *dev = NULL;
 	int i, rc = 0;
 
-	if (!core || !core->pdev) {
-		d_vpr_e("%s: Invalid params\n", __func__);
-		return -EINVAL;
-	}
 	dev = &core->pdev->dev;
 
 	/* select platform based on compatible match */
@@ -350,11 +337,6 @@ int msm_vidc_init_platform(struct msm_vidc_core *core)
 
 	d_vpr_h("%s()\n", __func__);
 
-	if (!core) {
-		d_vpr_e("%s: invalid param\n", __func__);
-		return -EINVAL;
-	}
-
 	platform = devm_kzalloc(&core->pdev->dev,
 		sizeof(struct msm_vidc_platform), GFP_KERNEL);
 	if (!platform) {
@@ -363,7 +345,6 @@ int msm_vidc_init_platform(struct msm_vidc_core *core)
 	}
 
 	core->platform = platform;
-	platform->core = core;
 
 	/* selected ops can be re-assigned in platform specific file */
 	rc = msm_vidc_init_ops(core);
@@ -3246,10 +3227,6 @@ int msm_vidc_set_csc_custom_matrix(void *instance,
 	s32 csc_limit_payload[MAX_LIMIT_COEFFS + 2];
 
 	core = inst->core;
-	if (!core->platform) {
-		d_vpr_e("%s: invalid core platform\n", __func__);
-		return -EINVAL;
-	}
 	csc_coeff = &core->platform->data.csc_data;
 
 	if (!inst->capabilities[cap_id].value ||

+ 0 - 4
driver/platform/kalama/src/msm_vidc_kalama.c

@@ -2845,10 +2845,6 @@ static int msm_vidc_init_data(struct msm_vidc_core *core)
 	struct device *dev = NULL;
 	int rc = 0;
 
-	if (!core || !core->pdev || !core->platform) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
 	dev = &core->pdev->dev;
 
 	d_vpr_h("%s: initialize kalama data\n", __func__);

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

@@ -2960,10 +2960,6 @@ static int msm_vidc_init_data(struct msm_vidc_core *core)
 	struct device *dev = NULL;
 	int rc = 0;
 
-	if (!core || !core->pdev || !core->platform) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
 	dev = &core->pdev->dev;
 
 	d_vpr_h("%s: initialize pineapple data\n", __func__);

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

@@ -1742,10 +1742,6 @@ static int msm_vidc_init_data(struct msm_vidc_core *core)
 {
 	int rc = 0;
 
-	if (!core || !core->platform) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
 	d_vpr_h("%s: initialize pineapple data\n", __func__);
 
 	core->platform->data = pineapple_data;

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

@@ -1836,10 +1836,6 @@ static int msm_vidc_init_data(struct msm_vidc_core *core)
 {
 	int rc = 0;
 
-	if (!core || !core->platform) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
 	d_vpr_h("%s: initialize waipio data\n", __func__);
 
 	core->platform->data = waipio_data;

+ 0 - 25
driver/variant/common/src/msm_vidc_variant.c

@@ -21,11 +21,6 @@ int __write_register(struct msm_vidc_core *core, u32 reg, u32 value)
 	u8 *base_addr;
 	int rc = 0;
 
-	if (!core || !core->resource) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	rc = __strict_check(core, __func__);
 	if (rc)
 		return rc;
@@ -58,11 +53,6 @@ int __write_register_masked(struct msm_vidc_core *core, u32 reg, u32 value,
 	u8 *base_addr;
 	int rc = 0;
 
-	if (!core || !core->resource) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	rc = __strict_check(core, __func__);
 	if (rc)
 		return rc;
@@ -100,11 +90,6 @@ int __read_register(struct msm_vidc_core *core, u32 reg, u32 *value)
 	int rc = 0;
 	u8 *base_addr;
 
-	if (!core || !core->resource || !value) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	if (!is_core_sub_state(core, CORE_SUBSTATE_POWER_ENABLE)) {
 		d_vpr_e("HFI Read register failed : Power is OFF\n");
 		return -EINVAL;
@@ -131,11 +116,6 @@ int __read_register_with_poll_timeout(struct msm_vidc_core *core, u32 reg,
 	u32 val = 0;
 	u8 *addr;
 
-	if (!core || !core->resource) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	if (!is_core_sub_state(core, CORE_SUBSTATE_POWER_ENABLE)) {
 		d_vpr_e("%s failed: Power is OFF\n", __func__);
 		return -EINVAL;
@@ -163,11 +143,6 @@ int __set_registers(struct msm_vidc_core *core)
 	unsigned int prst_count;
 	int cnt, rc = 0;
 
-	if (!core || !core->platform) {
-		d_vpr_e("core resources null, cannot set registers\n");
-		return -EINVAL;
-	}
-
 	reg_prst = core->platform->data.reg_prst_tbl;
 	prst_count = core->platform->data.reg_prst_tbl_size;
 

+ 8 - 67
driver/variant/iris2/src/msm_vidc_iris2.c

@@ -171,17 +171,11 @@
 #define VCODEC_NOC_ERL_MAIN_ERRLOG3_LOW			0x00011238
 #define VCODEC_NOC_ERL_MAIN_ERRLOG3_HIGH		0x0001123C
 
-static int __interrupt_init_iris2(struct msm_vidc_core *vidc_core)
+static int __interrupt_init_iris2(struct msm_vidc_core *core)
 {
-	struct msm_vidc_core *core = vidc_core;
 	u32 mask_val = 0;
 	int rc = 0;
 
-	if (!core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	/* All interrupts should be disabled initially 0x1F6 : Reset value */
 	rc = __read_register(core, WRAPPER_INTR_MASK_IRIS2, &mask_val);
 	if (rc)
@@ -197,17 +191,11 @@ static int __interrupt_init_iris2(struct msm_vidc_core *vidc_core)
 	return 0;
 }
 
-static int __setup_ucregion_memory_map_iris2(struct msm_vidc_core *vidc_core)
+static int __setup_ucregion_memory_map_iris2(struct msm_vidc_core *core)
 {
-	struct msm_vidc_core *core = vidc_core;
 	u32 value;
 	int rc = 0;
 
-	if (!core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	value = (u32)core->iface_q_table.align_device_addr;
 	rc = __write_register(core, UC_REGION_ADDR_IRIS2, value);
 	if (rc)
@@ -413,11 +401,6 @@ static int __power_off_iris2(struct msm_vidc_core *core)
 {
 	int rc = 0;
 
-	if (!core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	if (!is_core_sub_state(core, CORE_SUBSTATE_POWER_ENABLE))
 		return 0;
 
@@ -571,17 +554,11 @@ fail_vote_buses:
 	return rc;
 }
 
-static int __prepare_pc_iris2(struct msm_vidc_core *vidc_core)
+static int __prepare_pc_iris2(struct msm_vidc_core *core)
 {
 	int rc = 0;
 	u32 wfi_status = 0, idle_status = 0, pc_ready = 0;
 	u32 ctrl_status = 0;
-	struct msm_vidc_core *core = vidc_core;
-
-	if (!core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
 
 	rc = __read_register(core, CTRL_STATUS_IRIS2, &ctrl_status);
 	if (rc)
@@ -638,16 +615,10 @@ skip_power_off:
 	return -EAGAIN;
 }
 
-static int __raise_interrupt_iris2(struct msm_vidc_core *vidc_core)
+static int __raise_interrupt_iris2(struct msm_vidc_core *core)
 {
-	struct msm_vidc_core *core = vidc_core;
 	int rc = 0;
 
-	if (!core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	rc = __write_register(core, CPU_IC_SOFTINT_IRIS2, 1 << CPU_IC_SOFTINT_H2A_SHFT_IRIS2);
 	if (rc)
 		return rc;
@@ -655,15 +626,9 @@ static int __raise_interrupt_iris2(struct msm_vidc_core *vidc_core)
 	return 0;
 }
 
-static int __watchdog_iris2(struct msm_vidc_core *vidc_core, u32 intr_status)
+static int __watchdog_iris2(struct msm_vidc_core *core, u32 intr_status)
 {
 	int rc = 0;
-	struct msm_vidc_core *core = vidc_core;
-
-	if (!core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
 
 	if (intr_status & WRAPPER_INTR_STATUS_A2HWD_BMSK_IRIS2) {
 		d_vpr_e("%s: received watchdog interrupt\n", __func__);
@@ -673,15 +638,8 @@ static int __watchdog_iris2(struct msm_vidc_core *vidc_core, u32 intr_status)
 	return rc;
 }
 
-static int __noc_error_info_iris2(struct msm_vidc_core *vidc_core)
+static int __noc_error_info_iris2(struct msm_vidc_core *core)
 {
-	struct msm_vidc_core *core = vidc_core;
-
-	if (!core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	/*
 	 * we are not supposed to access vcodec subsystem registers
 	 * unless vcodec core clock WRAPPER_CORE_CLOCK_CONFIG_IRIS2 is enabled.
@@ -721,17 +679,11 @@ static int __noc_error_info_iris2(struct msm_vidc_core *vidc_core)
 	return 0;
 }
 
-static int __clear_interrupt_iris2(struct msm_vidc_core *vidc_core)
+static int __clear_interrupt_iris2(struct msm_vidc_core *core)
 {
-	struct msm_vidc_core *core = vidc_core;
 	u32 intr_status = 0, mask = 0;
 	int rc = 0;
 
-	if (!core) {
-		d_vpr_e("%s: NULL core\n", __func__);
-		return 0;
-	}
-
 	rc = __read_register(core, WRAPPER_INTR_STATUS_IRIS2, &intr_status);
 	if (rc)
 		return rc;
@@ -756,16 +708,10 @@ static int __clear_interrupt_iris2(struct msm_vidc_core *vidc_core)
 	return 0;
 }
 
-static int __boot_firmware_iris2(struct msm_vidc_core *vidc_core)
+static int __boot_firmware_iris2(struct msm_vidc_core *core)
 {
 	int rc = 0;
 	u32 ctrl_init_val = 0, ctrl_status = 0, count = 0, max_tries = 1000;
-	struct msm_vidc_core *core = vidc_core;
-
-	if (!core) {
-		d_vpr_e("%s: NULL core\n", __func__);
-		return 0;
-	}
 
 	rc = __setup_ucregion_memory_map_iris2(core);
 	if (rc)
@@ -1003,11 +949,6 @@ static struct msm_vidc_session_ops msm_session_ops = {
 
 int msm_vidc_init_iris2(struct msm_vidc_core *core)
 {
-	if (!core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	d_vpr_h("%s()\n", __func__);
 	core->venus_ops = &iris2_ops;
 	core->session_ops = &msm_session_ops;

+ 8 - 67
driver/variant/iris3/src/msm_vidc_iris3.c

@@ -177,17 +177,11 @@
 #define VCODEC_NOC_ERL_MAIN_ERRLOG3_LOW			0x00011238
 #define VCODEC_NOC_ERL_MAIN_ERRLOG3_HIGH		0x0001123C
 
-static int __interrupt_init_iris3(struct msm_vidc_core *vidc_core)
+static int __interrupt_init_iris3(struct msm_vidc_core *core)
 {
-	struct msm_vidc_core *core = vidc_core;
 	u32 mask_val = 0;
 	int rc = 0;
 
-	if (!core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	/* All interrupts should be disabled initially 0x1F6 : Reset value */
 	rc = __read_register(core, WRAPPER_INTR_MASK_IRIS3, &mask_val);
 	if (rc)
@@ -203,17 +197,11 @@ static int __interrupt_init_iris3(struct msm_vidc_core *vidc_core)
 	return 0;
 }
 
-static int __setup_ucregion_memory_map_iris3(struct msm_vidc_core *vidc_core)
+static int __setup_ucregion_memory_map_iris3(struct msm_vidc_core *core)
 {
-	struct msm_vidc_core *core = vidc_core;
 	u32 value;
 	int rc = 0;
 
-	if (!core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	value = (u32)core->iface_q_table.align_device_addr;
 	rc = __write_register(core, UC_REGION_ADDR_IRIS3, value);
 	if (rc)
@@ -463,11 +451,6 @@ static int __power_off_iris3(struct msm_vidc_core *core)
 {
 	int rc = 0;
 
-	if (!core || !core->capabilities) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	if (!is_core_sub_state(core, CORE_SUBSTATE_POWER_ENABLE))
 		return 0;
 
@@ -618,17 +601,11 @@ fail_vote_buses:
 	return rc;
 }
 
-static int __prepare_pc_iris3(struct msm_vidc_core *vidc_core)
+static int __prepare_pc_iris3(struct msm_vidc_core *core)
 {
 	int rc = 0;
 	u32 wfi_status = 0, idle_status = 0, pc_ready = 0;
 	u32 ctrl_status = 0;
-	struct msm_vidc_core *core = vidc_core;
-
-	if (!core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
 
 	rc = __read_register(core, CTRL_STATUS_IRIS3, &ctrl_status);
 	if (rc)
@@ -685,16 +662,10 @@ skip_power_off:
 	return -EAGAIN;
 }
 
-static int __raise_interrupt_iris3(struct msm_vidc_core *vidc_core)
+static int __raise_interrupt_iris3(struct msm_vidc_core *core)
 {
-	struct msm_vidc_core *core = vidc_core;
 	int rc = 0;
 
-	if (!core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	rc = __write_register(core, CPU_IC_SOFTINT_IRIS3, 1 << CPU_IC_SOFTINT_H2A_SHFT_IRIS3);
 	if (rc)
 		return rc;
@@ -702,15 +673,9 @@ static int __raise_interrupt_iris3(struct msm_vidc_core *vidc_core)
 	return 0;
 }
 
-static int __watchdog_iris3(struct msm_vidc_core *vidc_core, u32 intr_status)
+static int __watchdog_iris3(struct msm_vidc_core *core, u32 intr_status)
 {
 	int rc = 0;
-	struct msm_vidc_core *core = vidc_core;
-
-	if (!core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
 
 	if (intr_status & WRAPPER_INTR_STATUS_A2HWD_BMSK_IRIS3) {
 		d_vpr_e("%s: received watchdog interrupt\n", __func__);
@@ -720,15 +685,8 @@ static int __watchdog_iris3(struct msm_vidc_core *vidc_core, u32 intr_status)
 	return rc;
 }
 
-static int __noc_error_info_iris3(struct msm_vidc_core *vidc_core)
+static int __noc_error_info_iris3(struct msm_vidc_core *core)
 {
-	struct msm_vidc_core *core = vidc_core;
-
-	if (!core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	/*
 	 * we are not supposed to access vcodec subsystem registers
 	 * unless vcodec core clock WRAPPER_CORE_CLOCK_CONFIG_IRIS3 is enabled.
@@ -768,17 +726,11 @@ static int __noc_error_info_iris3(struct msm_vidc_core *vidc_core)
 	return 0;
 }
 
-static int __clear_interrupt_iris3(struct msm_vidc_core *vidc_core)
+static int __clear_interrupt_iris3(struct msm_vidc_core *core)
 {
-	struct msm_vidc_core *core = vidc_core;
 	u32 intr_status = 0, mask = 0;
 	int rc = 0;
 
-	if (!core) {
-		d_vpr_e("%s: NULL core\n", __func__);
-		return 0;
-	}
-
 	rc = __read_register(core, WRAPPER_INTR_STATUS_IRIS3, &intr_status);
 	if (rc)
 		return rc;
@@ -803,16 +755,10 @@ static int __clear_interrupt_iris3(struct msm_vidc_core *vidc_core)
 	return 0;
 }
 
-static int __boot_firmware_iris3(struct msm_vidc_core *vidc_core)
+static int __boot_firmware_iris3(struct msm_vidc_core *core)
 {
 	int rc = 0;
 	u32 ctrl_init_val = 0, ctrl_status = 0, count = 0, max_tries = 1000;
-	struct msm_vidc_core *core = vidc_core;
-
-	if (!core) {
-		d_vpr_e("%s: NULL core\n", __func__);
-		return 0;
-	}
 
 	rc = __setup_ucregion_memory_map_iris3(core);
 	if (rc)
@@ -1084,11 +1030,6 @@ static struct msm_vidc_session_ops msm_session_ops = {
 
 int msm_vidc_init_iris3(struct msm_vidc_core *core)
 {
-	if (!core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	d_vpr_h("%s()\n", __func__);
 	core->venus_ops = &iris3_ops;
 	core->session_ops = &msm_session_ops;

+ 7 - 68
driver/variant/iris33/src/msm_vidc_iris33.c

@@ -128,17 +128,11 @@ typedef enum {
 #define NOC_ERL_ERRORLOGGER_MAIN_ERRORLOGGER_ERRLOG3_LOW   (NOC_BASE_OFFS + 0xA038)
 #define NOC_SIDEBANDMANAGER_MAIN_SIDEBANDMANAGER_FAULTINEN0_LOW (NOC_BASE_OFFS + 0x7040)
 
-static int __interrupt_init_iris33(struct msm_vidc_core *vidc_core)
+static int __interrupt_init_iris33(struct msm_vidc_core *core)
 {
-	struct msm_vidc_core *core = vidc_core;
 	u32 mask_val = 0;
 	int rc = 0;
 
-	if (!core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	/* All interrupts should be disabled initially 0x1F6 : Reset value */
 	rc = __read_register(core, WRAPPER_INTR_MASK_IRIS33, &mask_val);
 	if (rc)
@@ -161,10 +155,6 @@ static int __get_device_region_info(struct msm_vidc_core *core,
 	u32 min_addr, max_addr, count = 0;
 	int rc = 0;
 
-	if (!core || !core->resource) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
 	dev_set = &core->resource->device_region_set;
 
 	if (!dev_set->count) {
@@ -192,18 +182,12 @@ static int __get_device_region_info(struct msm_vidc_core *core,
 	return rc;
 }
 
-static int __program_bootup_registers_iris33(struct msm_vidc_core *vidc_core)
+static int __program_bootup_registers_iris33(struct msm_vidc_core *core)
 {
-	struct msm_vidc_core *core = vidc_core;
 	u32 min_dev_reg_addr = 0, dev_reg_size = 0;
 	u32 value;
 	int rc = 0;
 
-	if (!core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	value = (u32)core->iface_q_table.align_device_addr;
 	rc = __write_register(core, HFI_UC_REGION_ADDR_IRIS33, value);
 	if (rc)
@@ -573,11 +557,6 @@ static int __power_off_iris33(struct msm_vidc_core *core)
 {
 	int rc = 0;
 
-	if (!core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	if (!is_core_sub_state(core, CORE_SUBSTATE_POWER_ENABLE))
 		return 0;
 
@@ -808,17 +787,11 @@ fail_vote_buses:
 	return rc;
 }
 
-static int __prepare_pc_iris33(struct msm_vidc_core *vidc_core)
+static int __prepare_pc_iris33(struct msm_vidc_core *core)
 {
 	int rc = 0;
 	u32 wfi_status = 0, idle_status = 0, pc_ready = 0;
 	u32 ctrl_status = 0;
-	struct msm_vidc_core *core = vidc_core;
-
-	if (!core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
 
 	rc = __read_register(core, HFI_CTRL_STATUS_IRIS33, &ctrl_status);
 	if (rc)
@@ -875,16 +848,10 @@ skip_power_off:
 	return -EAGAIN;
 }
 
-static int __raise_interrupt_iris33(struct msm_vidc_core *vidc_core)
+static int __raise_interrupt_iris33(struct msm_vidc_core *core)
 {
-	struct msm_vidc_core *core = vidc_core;
 	int rc = 0;
 
-	if (!core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	rc = __write_register(core, CPU_IC_SOFTINT_IRIS33, 1 << CPU_IC_SOFTINT_H2A_SHFT_IRIS33);
 	if (rc)
 		return rc;
@@ -892,15 +859,9 @@ static int __raise_interrupt_iris33(struct msm_vidc_core *vidc_core)
 	return 0;
 }
 
-static int __watchdog_iris33(struct msm_vidc_core *vidc_core, u32 intr_status)
+static int __watchdog_iris33(struct msm_vidc_core *core, u32 intr_status)
 {
 	int rc = 0;
-	struct msm_vidc_core *core = vidc_core;
-
-	if (!core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
 
 	if (intr_status & WRAPPER_INTR_STATUS_A2HWD_BMSK_IRIS33) {
 		d_vpr_e("%s: received watchdog interrupt\n", __func__);
@@ -915,11 +876,6 @@ static int __noc_error_info_iris33(struct msm_vidc_core *core)
 	u32 value, count = 0;
 	int rc = 0;
 
-	if (!core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	/*
 	 * we are not supposed to access vcodec subsystem registers
 	 * unless vcodec core clock WRAPPER_CORE_CLOCK_CONFIG_IRIS33 is enabled.
@@ -1009,17 +965,11 @@ fail_assert_xo_reset:
 	return rc;
 }
 
-static int __clear_interrupt_iris33(struct msm_vidc_core *vidc_core)
+static int __clear_interrupt_iris33(struct msm_vidc_core *core)
 {
-	struct msm_vidc_core *core = vidc_core;
 	u32 intr_status = 0, mask = 0;
 	int rc = 0;
 
-	if (!core) {
-		d_vpr_e("%s: NULL core\n", __func__);
-		return 0;
-	}
-
 	rc = __read_register(core, WRAPPER_INTR_STATUS_IRIS33, &intr_status);
 	if (rc)
 		return rc;
@@ -1044,16 +994,10 @@ static int __clear_interrupt_iris33(struct msm_vidc_core *vidc_core)
 	return 0;
 }
 
-static int __boot_firmware_iris33(struct msm_vidc_core *vidc_core)
+static int __boot_firmware_iris33(struct msm_vidc_core *core)
 {
 	int rc = 0;
 	u32 ctrl_init_val = 0, ctrl_status = 0, count = 0, max_tries = 1000;
-	struct msm_vidc_core *core = vidc_core;
-
-	if (!core) {
-		d_vpr_e("%s: NULL core\n", __func__);
-		return 0;
-	}
 
 	rc = __program_bootup_registers_iris33(core);
 	if (rc)
@@ -1333,11 +1277,6 @@ static struct msm_vidc_session_ops msm_session_ops = {
 
 int msm_vidc_init_iris33(struct msm_vidc_core *core)
 {
-	if (!core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	d_vpr_h("%s()\n", __func__);
 	core->venus_ops = &iris33_ops;
 	core->session_ops = &msm_session_ops;

+ 0 - 1
driver/vidc/inc/resources.h

@@ -235,7 +235,6 @@ struct device_region_set {
 };
 
 struct msm_vidc_resource {
-	void                      *core;
 	u8 __iomem                *register_base_addr;
 	u32                        irq;
 	struct bus_set             bus_set;

+ 0 - 3
driver/vidc/src/firmware.c

@@ -37,9 +37,6 @@ static int protect_cp_mem(struct msm_vidc_core *core)
 	int rc = 0;
 	struct context_bank_info *cb;
 
-	if (!core)
-		return -EINVAL;
-
 	memprot.cp_start = 0x0;
 	memprot.cp_size = 0x0;
 	memprot.cp_nonpixel_start = 0x0;

+ 0 - 25
driver/vidc/src/hfi_packet.c

@@ -385,11 +385,6 @@ int hfi_packet_sys_init(struct msm_vidc_core *core,
 	u32 payload = 0;
 	u32 synx_client_data[2];
 
-	if (!core || !pkt) {
-		d_vpr_e("%s: Invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	rc = hfi_create_header(pkt, pkt_size,
 				   0 /*session_id*/,
 				   core->header_id++);
@@ -542,11 +537,6 @@ int hfi_packet_image_version(struct msm_vidc_core *core,
 {
 	int rc = 0;
 
-	if (!core || !pkt) {
-		d_vpr_e("%s: Invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	rc = hfi_create_header(pkt, pkt_size,
 				   0 /*session_id*/,
 				   core->header_id++);
@@ -579,11 +569,6 @@ int hfi_packet_sys_pc_prep(struct msm_vidc_core *core,
 {
 	int rc = 0;
 
-	if (!core || !pkt) {
-		d_vpr_e("%s: Invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	rc = hfi_create_header(pkt, pkt_size,
 			   0 /*session_id*/,
 			   core->header_id++);
@@ -615,11 +600,6 @@ int hfi_packet_sys_debug_config(struct msm_vidc_core *core,
 	int rc = 0;
 	u32 payload = 0;
 
-	if (!core || !pkt) {
-		d_vpr_e("%s: Invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	rc = hfi_create_header(pkt, pkt_size,
 				   0 /*session_id*/,
 				   core->header_id++);
@@ -700,11 +680,6 @@ int hfi_packet_sys_intraframe_powercollapse(struct msm_vidc_core *core,
 	int rc = 0;
 	u32 payload = 0;
 
-	if (!core || !pkt) {
-		d_vpr_e("%s: Invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	rc = hfi_create_header(pkt, pkt_size,
 		0 /*session_id*/,
 		core->header_id++);

+ 0 - 14
driver/vidc/src/msm_vdec.c

@@ -903,11 +903,6 @@ static int msm_vdec_subscribe_input_port_settings_change(struct msm_vidc_inst *i
 	i_vpr_h(inst, "%s()\n", __func__);
 
 	core = inst->core;
-	if (!core->platform) {
-		d_vpr_e("%s: invalid platform data\n", __func__);
-		return -EINVAL;
-	}
-
 	payload[0] = HFI_MODE_PORT_SETTINGS_CHANGE;
 	if (inst->codec == MSM_VIDC_H264) {
 		subscribe_psc_size = core->platform->data.psc_avc_tbl_size;
@@ -977,11 +972,6 @@ static int msm_vdec_subscribe_property(struct msm_vidc_inst *inst,
 	core = inst->core;
 	i_vpr_h(inst, "%s()\n", __func__);
 
-	if (!core->platform) {
-		d_vpr_e("%s: invalid platform data\n", __func__);
-		return -EINVAL;
-	}
-
 	payload[0] = HFI_MODE_PROPERTY;
 
 	if (port == INPUT_PORT) {
@@ -1635,10 +1625,6 @@ static int msm_vdec_subscribe_output_port_settings_change(struct msm_vidc_inst *
 	i_vpr_h(inst, "%s()\n", __func__);
 
 	core = inst->core;
-	if (!core->platform) {
-		d_vpr_e("%s: invalid platform data\n", __func__);
-		return -EINVAL;
-	}
 
 	payload[0] = HFI_MODE_PORT_SETTINGS_CHANGE;
 	if (inst->codec == MSM_VIDC_H264) {

+ 0 - 10
driver/vidc/src/msm_venc.c

@@ -545,11 +545,6 @@ static int msm_venc_get_input_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_input_internal_buffer_type); i++) {
 		rc = msm_vidc_get_internal_buffers(inst,
 			msm_venc_input_internal_buffer_type[i]);
@@ -1675,11 +1670,6 @@ int msm_venc_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->fh, sub, MAX_EVENTS, NULL);

+ 0 - 4
driver/vidc/src/msm_vidc.c

@@ -700,10 +700,6 @@ void *msm_vidc_open(struct msm_vidc_core *core, u32 session_type)
 	int i = 0;
 
 	d_vpr_h("%s: %s\n", __func__, video_banner);
-	if (!core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return NULL;
-	}
 
 	if (session_type != MSM_VIDC_DECODER &&
 	    session_type != MSM_VIDC_ENCODER) {

+ 22 - 2
driver/vidc/src/msm_vidc_debug.c

@@ -293,7 +293,7 @@ static ssize_t core_info_read(struct file *file, char __user *buf,
 	ssize_t len = 0;
 	int rc = 0;
 
-	if (!core || !core->resource) {
+	if (!core) {
 		d_vpr_e("%s: invalid params %pK\n", __func__, core);
 		return 0;
 	}
@@ -333,6 +333,11 @@ static ssize_t stats_delay_write_ms(struct file *filp, const char __user *buf,
 	char kbuf[MAX_DEBUG_LEVEL_STRING_LEN] = {0};
 	u32 delay_ms = 0;
 
+	if (!core) {
+		d_vpr_e("%s: invalid params %pK\n", __func__, core);
+		return 0;
+	}
+
 	/* filter partial writes and invalid commands */
 	if (*ppos != 0 || count >= sizeof(kbuf) || count == 0) {
 		d_vpr_e("returning error - pos %lld, count %lu\n", *ppos, count);
@@ -367,6 +372,11 @@ static ssize_t stats_delay_read_ms(struct file *file, char __user *buf,
 	char kbuf[MAX_DEBUG_LEVEL_STRING_LEN];
 	struct msm_vidc_core *core = file->private_data;
 
+	if (!core) {
+		d_vpr_e("%s: invalid params %pK\n", __func__, core);
+		return 0;
+	}
+
 	len = scnprintf(kbuf, sizeof(kbuf), "%u\n", core->capabilities[STATS_TIMEOUT_MS].value);
 	return simple_read_from_buffer(buf, count, ppos, kbuf, len);
 }
@@ -386,6 +396,11 @@ static ssize_t trigger_ssr_write(struct file *filp, const char __user *buf,
 	size_t size = MAX_SSR_STRING_LEN;
 	char kbuf[MAX_SSR_STRING_LEN + 1] = { 0 };
 
+	if (!core) {
+		d_vpr_e("%s: invalid params %pK\n", __func__, core);
+		return 0;
+	}
+
 	if (!buf)
 		return -EINVAL;
 
@@ -427,6 +442,11 @@ static ssize_t trigger_stability_write(struct file *filp, const char __user *buf
 	size_t size = MAX_STABILITY_STRING_LEN;
 	char kbuf[MAX_STABILITY_STRING_LEN + 1] = { 0 };
 
+	if (!core) {
+		d_vpr_e("%s: invalid params %pK\n", __func__, core);
+		return 0;
+	}
+
 	if (!buf)
 		return -EINVAL;
 
@@ -497,7 +517,7 @@ struct dentry *msm_vidc_debugfs_init_core(struct msm_vidc_core *core)
 	char debugfs_name[MAX_DEBUGFS_NAME];
 	struct dentry *parent;
 
-	if (!core || !core->debugfs_parent) {
+	if (!core->debugfs_parent) {
 		d_vpr_e("%s: invalid params\n", __func__);
 		goto failed_create_dir;
 	}

+ 0 - 124
driver/vidc/src/msm_vidc_driver.c

@@ -119,10 +119,6 @@ const char *v4l2_pixelfmt_name(struct msm_vidc_inst *inst, u32 pixfmt)
 	u32 i, size;
 
 	core = inst->core;
-	if (!core->platform || !core->platform->data.format_data) {
-		d_vpr_e("%s: invalid core platform\n", __func__);
-		goto exit;
-	}
 	codec_info = core->platform->data.format_data->codec_info;
 	size = core->platform->data.format_data->codec_info_size;
 
@@ -139,7 +135,6 @@ const char *v4l2_pixelfmt_name(struct msm_vidc_inst *inst, u32 pixfmt)
 			return color_format_info[i].pixfmt_name;
 	}
 
-exit:
 	return "UNKNOWN";
 }
 
@@ -239,11 +234,6 @@ int msm_vidc_suspend(struct msm_vidc_core *core)
 {
 	int rc = 0;
 
-	if (!core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	rc = venus_hfi_suspend(core);
 	if (rc)
 		return rc;
@@ -430,10 +420,6 @@ enum msm_vidc_codec_type v4l2_codec_to_driver(struct msm_vidc_inst *inst,
 	enum msm_vidc_codec_type codec = 0;
 
 	core = inst->core;
-	if (!core->platform || !core->platform->data.format_data) {
-		d_vpr_e("%s: invalid core platform\n", __func__);
-		return -EINVAL;
-	}
 	codec_info = core->platform->data.format_data->codec_info;
 	size = core->platform->data.format_data->codec_info_size;
 
@@ -455,10 +441,6 @@ u32 v4l2_codec_from_driver(struct msm_vidc_inst *inst,
 	u32 v4l2_codec = 0;
 
 	core = inst->core;
-	if (!core->platform || !core->platform->data.format_data) {
-		d_vpr_e("%s: invalid core platform\n", __func__);
-		return -EINVAL;
-	}
 	codec_info = core->platform->data.format_data->codec_info;
 	size = core->platform->data.format_data->codec_info_size;
 
@@ -481,10 +463,6 @@ enum msm_vidc_colorformat_type v4l2_colorformat_to_driver(
 	enum msm_vidc_colorformat_type colorformat = 0;
 
 	core = inst->core;
-	if (!core->platform || !core->platform->data.format_data) {
-		d_vpr_e("%s: invalid core platform\n", __func__);
-		return -EINVAL;
-	}
 	color_format_info = core->platform->data.format_data->color_format_info;
 	size = core->platform->data.format_data->color_format_info_size;
 
@@ -507,10 +485,6 @@ u32 v4l2_colorformat_from_driver(struct msm_vidc_inst *inst,
 	u32 v4l2_colorformat = 0;
 
 	core = inst->core;
-	if (!core->platform || !core->platform->data.format_data) {
-		d_vpr_e("%s: invalid core platform\n", __func__);
-		return -EINVAL;
-	}
 	color_format_info = core->platform->data.format_data->color_format_info;
 	size = core->platform->data.format_data->color_format_info_size;
 
@@ -532,10 +506,6 @@ u32 v4l2_color_primaries_to_driver(struct msm_vidc_inst *inst,
 	u32 vidc_color_primaries = MSM_VIDC_PRIMARIES_RESERVED;
 
 	core = inst->core;
-	if (!core->platform || !core->platform->data.format_data) {
-		d_vpr_e("%s: invalid core platform\n", __func__);
-		return -EINVAL;
-	}
 	color_prim_info = core->platform->data.format_data->color_prim_info;
 	size = core->platform->data.format_data->color_prim_info_size;
 
@@ -559,10 +529,6 @@ u32 v4l2_color_primaries_from_driver(struct msm_vidc_inst *inst,
 	u32 v4l2_primaries = V4L2_COLORSPACE_DEFAULT;
 
 	core = inst->core;
-	if (!core->platform || !core->platform->data.format_data) {
-		d_vpr_e("%s: invalid core platform\n", __func__);
-		return -EINVAL;
-	}
 	color_prim_info = core->platform->data.format_data->color_prim_info;
 	size = core->platform->data.format_data->color_prim_info_size;
 
@@ -586,10 +552,6 @@ u32 v4l2_transfer_char_to_driver(struct msm_vidc_inst *inst,
 	u32 vidc_transfer_char = MSM_VIDC_TRANSFER_RESERVED;
 
 	core = inst->core;
-	if (!core->platform || !core->platform->data.format_data) {
-		d_vpr_e("%s: invalid core platform\n", __func__);
-		return -EINVAL;
-	}
 	transfer_char_info = core->platform->data.format_data->transfer_char_info;
 	size = core->platform->data.format_data->transfer_char_info_size;
 
@@ -613,10 +575,6 @@ u32 v4l2_transfer_char_from_driver(struct msm_vidc_inst *inst,
 	u32  v4l2_transfer_char = V4L2_XFER_FUNC_DEFAULT;
 
 	core = inst->core;
-	if (!core->platform || !core->platform->data.format_data) {
-		d_vpr_e("%s: invalid core platform\n", __func__);
-		return -EINVAL;
-	}
 	transfer_char_info = core->platform->data.format_data->transfer_char_info;
 	size = core->platform->data.format_data->transfer_char_info_size;
 
@@ -640,10 +598,6 @@ u32 v4l2_matrix_coeff_to_driver(struct msm_vidc_inst *inst,
 	u32 vidc_matrix_coeff = MSM_VIDC_MATRIX_COEFF_RESERVED;
 
 	core = inst->core;
-	if (!core->platform || !core->platform->data.format_data) {
-		d_vpr_e("%s: invalid core platform\n", __func__);
-		return -EINVAL;
-	}
 	matrix_coeff_info = core->platform->data.format_data->matrix_coeff_info;
 	size = core->platform->data.format_data->matrix_coeff_info_size;
 
@@ -667,10 +621,6 @@ u32 v4l2_matrix_coeff_from_driver(struct msm_vidc_inst *inst,
 	u32 v4l2_matrix_coeff = V4L2_YCBCR_ENC_DEFAULT;
 
 	core = inst->core;
-	if (!core->platform || !core->platform->data.format_data) {
-		d_vpr_e("%s: invalid core platform\n", __func__);
-		return -EINVAL;
-	}
 	matrix_coeff_info = core->platform->data.format_data->matrix_coeff_info;
 	size = core->platform->data.format_data->matrix_coeff_info_size;
 
@@ -971,11 +921,6 @@ bool msm_vidc_allow_psc_last_flag(struct msm_vidc_inst *inst)
 
 enum msm_vidc_allow msm_vidc_allow_pm_suspend(struct msm_vidc_core *core)
 {
-	if (!core) {
-		d_vpr_e("%s: invalid param\n", __func__);
-		return MSM_VIDC_DISALLOW;
-	}
-
 	/* core must be in valid state to do pm_suspend */
 	if (!core_in_valid_state(core)) {
 		d_vpr_e("%s: invalid core state %s\n",
@@ -3520,12 +3465,6 @@ int msm_vidc_init_core_caps(struct msm_vidc_core *core)
 	int i, num_platform_caps;
 	struct msm_platform_core_capability *platform_data;
 
-	if (!core || !core->platform) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		rc = -EINVAL;
-		goto exit;
-	}
-
 	platform_data = core->platform->data.core_data;
 	if (!platform_data) {
 		d_vpr_e("%s: platform core data is NULL\n",
@@ -3609,12 +3548,6 @@ int msm_vidc_init_instance_caps(struct msm_vidc_core *core)
 	struct msm_platform_inst_capability *platform_cap_data = NULL;
 	struct msm_platform_inst_cap_dependency *platform_cap_dependency_data = NULL;
 
-	if (!core || !core->platform) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		rc = -EINVAL;
-		goto error;
-	}
-
 	platform_cap_data = core->platform->data.inst_cap_data;
 	if (!platform_cap_data) {
 		d_vpr_e("%s: platform instance cap data is NULL\n",
@@ -3731,11 +3664,6 @@ int msm_vidc_core_deinit_locked(struct msm_vidc_core *core, bool force)
 	struct msm_vidc_inst *inst, *dummy;
 	enum msm_vidc_allow allow;
 
-	if (!core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	rc = __strict_check(core, __func__);
 	if (rc) {
 		d_vpr_e("%s(): core was not locked\n", __func__);
@@ -3779,10 +3707,6 @@ int msm_vidc_core_deinit_locked(struct msm_vidc_core *core, bool force)
 int msm_vidc_core_deinit(struct msm_vidc_core *core, bool force)
 {
 	int rc = 0;
-	if (!core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
 
 	core_lock(core, __func__);
 	rc = msm_vidc_core_deinit_locked(core, force);
@@ -3796,11 +3720,6 @@ int msm_vidc_core_init_wait(struct msm_vidc_core *core)
 	const int interval = 10;
 	int max_tries, count = 0, rc = 0;
 
-	if (!core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	core_lock(core, __func__);
 	if (is_core_state(core, MSM_VIDC_CORE_INIT)) {
 		rc = 0;
@@ -3858,11 +3777,6 @@ int msm_vidc_core_init(struct msm_vidc_core *core)
 	enum msm_vidc_allow allow;
 	int rc = 0;
 
-	if (!core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	core_lock(core, __func__);
 	if (core_in_valid_state(core)) {
 		goto unlock;
@@ -4054,11 +3968,6 @@ void msm_vidc_print_core_info(struct msm_vidc_core *core)
 	struct msm_vidc_inst *instances[MAX_SUPPORTED_INSTANCES];
 	s32 num_instances = 0;
 
-	if (!core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return;
-	}
-
 	core_lock(core, __func__);
 	list_for_each_entry(inst, &core->instances, list)
 		instances[num_instances++] = inst;
@@ -4081,12 +3990,6 @@ int msm_vidc_smmu_fault_handler(struct iommu_domain *domain,
 {
 	struct msm_vidc_core *core = data;
 
-	if (!domain || !core) {
-		d_vpr_e("%s: invalid params %pK %pK\n",
-			__func__, domain, core);
-		return -EINVAL;
-	}
-
 	if (is_core_sub_state(core, CORE_SUBSTATE_PAGE_FAULT)) {
 		if (core->capabilities[NON_FATAL_FAULTS].value) {
 			dprintk_ratelimit(VIDC_ERR, "err ",
@@ -4118,10 +4021,6 @@ int msm_vidc_trigger_ssr(struct msm_vidc_core *core,
 {
 	struct msm_vidc_ssr *ssr;
 
-	if (!core) {
-		d_vpr_e("%s: Invalid parameters\n", __func__);
-		return -EINVAL;
-	}
 	ssr = &core->ssr;
 	/*
 	 * <test_addr><sub_client_id><ssr_type>
@@ -4181,11 +4080,6 @@ int msm_vidc_trigger_stability(struct msm_vidc_core *core,
 	struct msm_vidc_inst *inst = NULL;
 	struct msm_vidc_stability stability;
 
-	if (!core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	/*
 	 * <payload><sub_client_id><stability_type>
 	 * stability_type: 0-3 bits
@@ -4592,11 +4486,6 @@ struct msm_vidc_inst *get_inst_ref(struct msm_vidc_core *core,
 	struct msm_vidc_inst *inst = NULL;
 	bool matches = false;
 
-	if (!core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return NULL;
-	}
-
 	mutex_lock(&core->lock);
 	list_for_each_entry(inst, &core->instances, list) {
 		if (inst == instance) {
@@ -4615,11 +4504,6 @@ struct msm_vidc_inst *get_inst(struct msm_vidc_core *core,
 	struct msm_vidc_inst *inst = NULL;
 	bool matches = false;
 
-	if (!core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return NULL;
-	}
-
 	mutex_lock(&core->lock);
 	list_for_each_entry(inst, &core->instances, list) {
 		if (inst->session_id == session_id) {
@@ -4802,9 +4686,6 @@ int msm_vidc_update_buffer_count(struct msm_vidc_inst *inst, u32 port)
 
 void msm_vidc_schedule_core_deinit(struct msm_vidc_core *core)
 {
-	if (!core)
-		return;
-
 	if (!core->capabilities[FW_UNLOAD].value)
 		return;
 
@@ -5534,11 +5415,6 @@ struct context_bank_info *msm_vidc_get_context_bank_for_device(
 {
 	struct context_bank_info *cb = NULL, *match = NULL;
 
-	if (!core || !dev) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return NULL;
-	}
-
 	venus_hfi_for_each_context_bank(core, cb) {
 		if (of_device_is_compatible(dev->of_node, cb->name)) {
 			match = cb;

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

@@ -324,7 +324,7 @@ static struct dma_buf_attachment *msm_vidc_dma_buf_attach(struct msm_vidc_core *
 	int rc = 0;
 	struct dma_buf_attachment *attach = NULL;
 
-	if (!core || !dbuf || !dev) {
+	if (!dbuf || !dev) {
 		d_vpr_e("%s: invalid params\n", __func__);
 		return NULL;
 	}
@@ -466,7 +466,7 @@ static int msm_vidc_dma_map_page(struct msm_vidc_core *core,
 	struct context_bank_info *cb = NULL;
 	dma_addr_t dma_addr;
 
-	if (!core || !mem) {
+	if (!mem) {
 		d_vpr_e("%s: invalid params\n", __func__);
 		return -EINVAL;
 	}
@@ -515,7 +515,7 @@ static int msm_vidc_dma_unmap_page(struct msm_vidc_core *core,
 	int rc = 0;
 	struct context_bank_info *cb = NULL;
 
-	if (!core || !mem) {
+	if (!mem) {
 		d_vpr_e("%s: invalid params\n", __func__);
 		return -EINVAL;
 	}
@@ -563,7 +563,7 @@ static int msm_vidc_iommu_map(struct msm_vidc_core *core, struct msm_vidc_mem *m
 	int rc = 0;
 	struct context_bank_info *cb = NULL;
 
-	if (!core || !mem) {
+	if (!mem) {
 		d_vpr_e("%s: invalid params\n", __func__);
 		return -EINVAL;
 	}
@@ -594,7 +594,7 @@ static int msm_vidc_iommu_unmap(struct msm_vidc_core *core, struct msm_vidc_mem
 	int rc = 0;
 	struct context_bank_info *cb = NULL;
 
-	if (!core || !mem) {
+	if (!mem) {
 		d_vpr_e("%s: invalid params\n", __func__);
 		return -EINVAL;
 	}

+ 4 - 4
driver/vidc/src/msm_vidc_memory_ext.c

@@ -29,7 +29,7 @@ static struct dma_buf_attachment *msm_vidc_dma_buf_attach_ext(struct msm_vidc_co
 	struct dma_buf_attachment *attach = NULL;
 	struct context_bank_info *cb = NULL;
 
-	if (!core || !dbuf || !dev) {
+	if (!dbuf || !dev) {
 		d_vpr_e("%s: invalid params\n", __func__);
 		return NULL;
 	}
@@ -231,7 +231,7 @@ static int msm_vidc_memory_map_ext(struct msm_vidc_core *core, struct msm_vidc_m
 	struct sg_table *table = NULL;
 	struct context_bank_info *cb = NULL;
 
-	if (!core || !mem) {
+	if (!mem) {
 		d_vpr_e("%s: invalid params\n", __func__);
 		return -EINVAL;
 	}
@@ -257,7 +257,7 @@ static int msm_vidc_memory_map_ext(struct msm_vidc_core *core, struct msm_vidc_m
 	}
 
 	cb = msm_vidc_get_context_bank_for_region(core, mem->region);
-	if (!cb) {
+	if (!cb || !cb->dev) {
 		d_vpr_e("%s: Failed to get context bank device\n",
 			 __func__);
 		rc = -EIO;
@@ -302,7 +302,7 @@ static int msm_vidc_memory_unmap_ext(struct msm_vidc_core *core,
 {
 	int rc = 0;
 
-	if (!core || !mem) {
+	if (!mem) {
 		d_vpr_e("%s: invalid params\n", __func__);
 		return -EINVAL;
 	}

+ 7 - 31
driver/vidc/src/msm_vidc_probe.c

@@ -66,17 +66,11 @@ static int msm_vidc_init_resources(struct msm_vidc_core *core)
 	struct msm_vidc_resource *res = NULL;
 	int rc = 0;
 
-	if (!core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	res = devm_kzalloc(&core->pdev->dev, sizeof(*res), GFP_KERNEL);
 	if (!res) {
 		d_vpr_e("%s: failed to alloc memory for resource\n", __func__);
 		return -ENOMEM;
 	}
-	res->core = core;
 	core->resource = res;
 
 	rc = call_res_op(core, init, core);
@@ -174,11 +168,6 @@ static int msm_vidc_register_video_device(struct msm_vidc_core *core,
 
 	d_vpr_h("%s: domain %d\n", __func__, type);
 
-	if (!core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	if (type == MSM_VIDC_DECODER) {
 		index = 0;
 		media_index = MEDIA_ENT_F_PROC_VIDEO_DECODER;
@@ -317,11 +306,6 @@ static int msm_vidc_check_mmrm_support(struct msm_vidc_core *core)
 {
 	int rc = 0;
 
-	if (!core || !core->platform) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	if (!is_mmrm_supported(core))
 		goto exit;
 
@@ -337,11 +321,6 @@ exit:
 #else
 static int msm_vidc_check_mmrm_support(struct msm_vidc_core *core)
 {
-	if (!core || !core->platform) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	core->platform->data.supports_mmrm = 0;
 
 	return 0;
@@ -377,10 +356,6 @@ static int msm_vidc_initialize_core(struct msm_vidc_core *core)
 {
 	int rc = 0;
 
-	if (!core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
 	d_vpr_h("%s()\n", __func__);
 
 	msm_vidc_update_core_state(core, MSM_VIDC_CORE_DEINIT, __func__);
@@ -499,11 +474,6 @@ static int msm_vidc_setup_context_bank(struct msm_vidc_core *core,
 	struct context_bank_info *cb = NULL;
 	int rc = 0;
 
-	if (!core || !dev) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	cb = msm_vidc_get_context_bank_for_device(core, dev);
 	if (!cb) {
 		d_vpr_e("%s: Failed to get context bank device for %s\n",
@@ -707,9 +677,10 @@ static int msm_vidc_remove_video_device(struct platform_device *pdev)
 		d_vpr_e("%s: invalid input %pK", __func__, pdev);
 		return -EINVAL;
 	}
+
 	core = dev_get_drvdata(&pdev->dev);
 	if (!core) {
-		d_vpr_e("%s: invalid core", __func__);
+		d_vpr_e("%s: invalid core\n", __func__);
 		return -EINVAL;
 	}
 
@@ -909,6 +880,11 @@ static int msm_vidc_probe(struct platform_device *pdev)
 {
 	d_vpr_h("%s()\n", __func__);
 
+	if (!pdev) {
+		d_vpr_e("%s: invalid params\n", __func__);
+		return -EINVAL;
+	}
+
 	/*
 	 * Sub devices probe will be triggered by of_platform_populate() towards
 	 * the end of the probe function after msm-vidc device probe is

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

@@ -87,11 +87,6 @@ static int msm_vidc_core_deinit_state(struct msm_vidc_core *core,
 {
 	int rc = 0;
 
-	if (!core || !data) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	switch (type) {
 	case CORE_EVENT_UPDATE_SUB_STATE:
 	{
@@ -127,11 +122,6 @@ static int msm_vidc_core_init_wait_state(struct msm_vidc_core *core,
 {
 	int rc = 0;
 
-	if (!core || !data) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	switch (type) {
 	case CORE_EVENT_UPDATE_SUB_STATE:
 	{
@@ -167,11 +157,6 @@ static int msm_vidc_core_init_state(struct msm_vidc_core *core,
 {
 	int rc = 0;
 
-	if (!core || !data) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	switch (type) {
 	case CORE_EVENT_UPDATE_SUB_STATE:
 	{
@@ -207,11 +192,6 @@ static int msm_vidc_core_error_state(struct msm_vidc_core *core,
 {
 	int rc = 0;
 
-	if (!core || !data) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	switch (type) {
 	case CORE_EVENT_UPDATE_SUB_STATE:
 	{
@@ -346,11 +326,6 @@ int msm_vidc_change_core_state(struct msm_vidc_core *core,
 	enum msm_vidc_allow allow;
 	int rc = 0;
 
-	if (!core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	/* core must be locked */
 	rc = __strict_check(core, func);
 	if (rc) {
@@ -436,11 +411,6 @@ static int msm_vidc_update_core_sub_state(struct msm_vidc_core *core,
 	char sub_state_name[MAX_NAME_LENGTH];
 	int ret = 0, rc = 0;
 
-	if (!core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	/* no substate update */
 	if (!sub_state)
 		return 0;
@@ -468,11 +438,6 @@ int msm_vidc_change_core_sub_state(struct msm_vidc_core *core,
 	int rc = 0;
 	enum msm_vidc_core_sub_state prev_sub_state;
 
-	if (!core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	/* core must be locked */
 	rc = __strict_check(core, func);
 	if (rc) {

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

@@ -118,11 +118,6 @@ static int msm_vidc_synx_fence_register(struct msm_vidc_core *core)
 	char synx_session_name[MAX_SYNX_FENCE_SESSION_NAME];
 	struct synx_queue_desc queue_desc;
 
-	if (!core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	if (!core->capabilities[SUPPORTS_SYNX_FENCE].value)
 		return 0;
 
@@ -164,11 +159,6 @@ static int msm_vidc_synx_fence_deregister(struct msm_vidc_core *core)
 {
 	int rc = 0;
 
-	if (!core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	if (!core->capabilities[SUPPORTS_SYNX_FENCE].value)
 		return 0;
 
@@ -328,11 +318,6 @@ static void msm_vidc_synx_fence_recover(struct msm_vidc_core *core)
 {
 	int rc = 0;
 
-	if (!core) {
-		d_vpr_e("%s: invalid paras\n", __func__);
-		return;
-	}
-
 	rc = synx_hwfence_recover(
 		(enum synx_client_id)core->synx_fence_data.client_id);
 	if (rc)

+ 0 - 100
driver/vidc/src/resources.c

@@ -194,10 +194,6 @@ static int __opp_set_rate(struct msm_vidc_core *core, u64 freq)
 	struct dev_pm_opp *opp;
 	int rc = 0;
 
-	if (!core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
 	opp_freq = freq;
 
 	/* find max(ceil) freq from opp table */
@@ -229,10 +225,6 @@ static int __init_register_base(struct msm_vidc_core *core)
 {
 	struct msm_vidc_resource *res;
 
-	if (!core || !core->pdev || !core->resource) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
 	res = core->resource;
 
 	res->register_base_addr = devm_platform_ioremap_resource(core->pdev, 0);
@@ -254,10 +246,6 @@ static int __init_irq(struct msm_vidc_core *core)
 #endif
 	int rc = 0;
 
-	if (!core || !core->pdev || !core->resource) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
 	res = core->resource;
 
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 16, 0))
@@ -290,10 +278,6 @@ static int __init_bus(struct msm_vidc_core *core)
 	u32 bus_count = 0, cnt = 0;
 	int rc = 0;
 
-	if (!core || !core->resource || !core->platform) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
 	interconnects = &core->resource->bus_set;
 
 	bus_tbl = core->platform->data.bw_tbl;
@@ -359,10 +343,6 @@ static int __init_power_domains(struct msm_vidc_core *core)
 	u32 pd_count = 0, opp_count = 0, cnt = 0;
 	int rc = 0;
 
-	if (!core || !core->resource || !core->platform) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
 	pds = &core->resource->power_domain_set;
 
 	pd_tbl = core->platform->data.pd_tbl;
@@ -490,10 +470,6 @@ static int __init_clocks(struct msm_vidc_core *core)
 	u32 clk_count = 0, freq_count = 0;
 	int fcnt = 0, cnt = 0, rc = 0;
 
-	if (!core || !core->resource || !core->platform) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
 	clocks = &core->resource->clock_set;
 
 	clk_tbl = core->platform->data.clk_tbl;
@@ -586,10 +562,6 @@ static int __init_reset_clocks(struct msm_vidc_core *core)
 	u32 rst_count = 0, cnt = 0;
 	int rc = 0;
 
-	if (!core || !core->resource || !core->platform) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
 	rsts = &core->resource->reset_set;
 
 	rst_tbl = core->platform->data.clk_rst_tbl;
@@ -649,10 +621,6 @@ static int __init_subcaches(struct msm_vidc_core *core)
 	u32 llcc_count = 0, cnt = 0;
 	int rc = 0;
 
-	if (!core || !core->resource || !core->platform) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
 	caches = &core->resource->subcache_set;
 
 	/* skip init if subcache not available */
@@ -711,10 +679,6 @@ static int __init_freq_table(struct msm_vidc_core *core)
 	u32 freq_count = 0, cnt = 0;
 	int rc = 0;
 
-	if (!core || !core->resource || !core->platform) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
 	clks = &core->resource->freq_set;
 
 	freq_tbl = core->platform->data.freq_tbl;
@@ -758,10 +722,6 @@ static int __init_context_banks(struct msm_vidc_core *core)
 	u32 cb_count = 0, cnt = 0;
 	int rc = 0;
 
-	if (!core || !core->resource || !core->platform) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
 	cbs = &core->resource->context_bank_set;
 
 	cb_tbl = core->platform->data.context_bank_tbl;
@@ -817,10 +777,6 @@ static int __init_device_region(struct msm_vidc_core *core)
 	u32 dev_reg_count = 0, cnt = 0;
 	int rc = 0;
 
-	if (!core || !core->resource || !core->platform) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
 	dev_set = &core->resource->device_region_set;
 
 	dev_reg_tbl = core->platform->data.dev_reg_tbl;
@@ -865,11 +821,6 @@ static int __register_mmrm(struct msm_vidc_core *core)
 	int rc = 0;
 	struct clock_info *cl;
 
-	if (!core || !core->platform) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	/* skip if platform does not support mmrm */
 	if (!is_mmrm_supported(core)) {
 		d_vpr_h("%s: MMRM not supported\n", __func__);
@@ -1100,11 +1051,6 @@ static int __unvote_buses(struct msm_vidc_core *core)
 	int rc = 0;
 	struct bus_info *bus = NULL;
 
-	if (!core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	core->power.bw_ddr = 0;
 	core->power.bw_llcc = 0;
 
@@ -1126,11 +1072,6 @@ static int __vote_buses(struct msm_vidc_core *core,
 	unsigned long bw_kbps = 0, bw_prev = 0;
 	enum vidc_bus_type type;
 
-	if (!core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	venus_hfi_for_each_bus(core, bus) {
 		if (bus && bus->icc) {
 			type = get_type_frm_name(bus->name);
@@ -1186,11 +1127,6 @@ static int print_residency_stats(struct msm_vidc_core *core, struct clock_info *
 	u64 total_time_us = 0;
 	int rc = 0;
 
-	if (!core || !cl) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	/* skip if scaling not supported */
 	if (!cl->has_scaling)
 		return 0;
@@ -1217,11 +1153,6 @@ static int reset_residency_stats(struct msm_vidc_core *core, struct clock_info *
 	struct clock_residency *residency = NULL;
 	int rc = 0;
 
-	if (!core || !cl) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	/* skip if scaling not supported */
 	if (!cl->has_scaling)
 		return 0;
@@ -1268,11 +1199,6 @@ static int update_residency_stats(
 	if (!(msm_vidc_debug & (VIDC_HIGH | VIDC_STAT)))
 		return 0;
 
-	if (!core || !cl) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	/* skip update if scaling not supported */
 	if (!cl->has_scaling)
 		return 0;
@@ -1316,12 +1242,6 @@ static int __set_clk_rate(struct msm_vidc_core *core, struct clock_info *cl,
 {
 	int rc = 0;
 
-	/* not registered */
-	if (!core || !cl) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	/* update clock residency stats */
 	update_residency_stats(core, cl, rate);
 
@@ -1374,11 +1294,6 @@ static int __disable_unprepare_clock(struct msm_vidc_core *core,
 	struct clock_info *cl;
 	bool found;
 
-	if (!core || !clk_name) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	found = false;
 	venus_hfi_for_each_clock(core, cl) {
 		if (!cl->clk) {
@@ -1411,11 +1326,6 @@ static int __prepare_enable_clock(struct msm_vidc_core *core,
 	bool found;
 	u64 rate = 0;
 
-	if (!core || !clk_name) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	found = false;
 	venus_hfi_for_each_clock(core, cl) {
 		if (!cl->clk) {
@@ -1729,11 +1639,6 @@ static int __print_clock_residency_stats(struct msm_vidc_core *core)
 	struct clock_info *cl;
 	int rc = 0;
 
-	if (!core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	venus_hfi_for_each_clock(core, cl) {
 		/* skip if scaling not supported */
 		if (!cl->has_scaling)
@@ -1751,11 +1656,6 @@ static int __reset_clock_residency_stats(struct msm_vidc_core *core)
 	struct clock_info *cl;
 	int rc = 0;
 
-	if (!core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	venus_hfi_for_each_clock(core, cl) {
 		/* skip if scaling not supported */
 		if (!cl->has_scaling)

+ 0 - 36
driver/vidc/src/resources_ext.c

@@ -31,10 +31,6 @@ static int __init_regulators(struct msm_vidc_core *core)
 	u32 regulator_count = 0, cnt = 0;
 	int rc = 0;
 
-	if (!core || !core->resource || !core->platform) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
 	regulators = &core->resource->regulator_set;
 
 	regulator_tbl = core->platform->data.regulator_tbl;
@@ -93,11 +89,6 @@ static int __acquire_regulator(struct msm_vidc_core *core,
 {
 	int rc = 0;
 
-	if (!core || !rinfo) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	if (rinfo->hw_power_collapse) {
 		if (!rinfo->regulator) {
 			d_vpr_e("%s: invalid regulator\n", __func__);
@@ -186,11 +177,6 @@ static int __enable_regulator(struct msm_vidc_core *core, const char *reg_name)
 	struct regulator_info *rinfo;
 	bool found;
 
-	if (!core || !reg_name) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	found = false;
 	venus_hfi_for_each_regulator(core, rinfo) {
 		if (!rinfo->regulator) {
@@ -231,11 +217,6 @@ static int __disable_regulator(struct msm_vidc_core *core, const char *reg_name)
 	struct regulator_info *rinfo;
 	bool found;
 
-	if (!core || !reg_name) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	found = false;
 	venus_hfi_for_each_regulator(core, rinfo) {
 		if (!rinfo->regulator) {
@@ -341,11 +322,6 @@ static int update_residency_stats(
 	if (!(msm_vidc_debug & (VIDC_HIGH | VIDC_STAT)))
 		return 0;
 
-	if (!core || !cl) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	/* skip update if scaling not supported */
 	if (!cl->has_scaling)
 		return 0;
@@ -393,12 +369,6 @@ static int __set_clk_rate(struct msm_vidc_core *core, struct clock_info *cl,
 	struct mmrm_client *client;
 	u64 srate;
 
-	/* not registered */
-	if (!core || !cl || !core->platform) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	if (is_mmrm_supported(core) && !cl->mmrm_client) {
 		d_vpr_e("%s: invalid mmrm client\n", __func__);
 		return -EINVAL;
@@ -452,12 +422,6 @@ static int __set_clk_rate(struct msm_vidc_core *core, struct clock_info *cl,
 	u64 srate;
 	int rc = 0;
 
-	/* not registered */
-	if (!core || !cl) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	/* update clock residency stats */
 	update_residency_stats(core, cl, rate);
 

+ 2 - 58
driver/vidc/src/venus_hfi.c

@@ -67,9 +67,6 @@ static bool __valdiate_session(struct msm_vidc_core *core,
 	struct msm_vidc_inst *temp;
 	int rc = 0;
 
-	if (!core)
-		return false;
-
 	rc = __strict_check(core, __func__);
 	if (rc)
 		return false;
@@ -88,10 +85,6 @@ static bool __valdiate_session(struct msm_vidc_core *core,
 
 static void __schedule_power_collapse_work(struct msm_vidc_core *core)
 {
-	if (!core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return;
-	}
 	if (!core->capabilities[SW_PC].value) {
 		d_vpr_l("software power collapse not enabled\n");
 		return;
@@ -108,10 +101,6 @@ static void __schedule_power_collapse_work(struct msm_vidc_core *core)
 
 static void __cancel_power_collapse_work(struct msm_vidc_core *core)
 {
-	if (!core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return;
-	}
 	if (!core->capabilities[SW_PC].value)
 		return;
 
@@ -126,11 +115,6 @@ static void __flush_debug_queue(struct msm_vidc_core *core,
 	bool local_packet = false;
 	enum vidc_msg_prio_fw log_level_fw = msm_fw_debug;
 
-	if (!core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return;
-	}
-
 	if (!packet || !packet_size) {
 		if (msm_vidc_vmem_alloc(VIDC_IFACEQ_VAR_HUGE_PKT_SIZE,
 			(void **)&packet, __func__))
@@ -281,10 +265,6 @@ static int __power_collapse(struct msm_vidc_core *core, bool force)
 {
 	int rc = 0;
 
-	if (!core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
 	if (!is_core_sub_state(core, CORE_SUBSTATE_POWER_ENABLE)) {
 		d_vpr_h("%s: Power already disabled\n", __func__);
 		goto exit;
@@ -479,10 +459,7 @@ static int __suspend(struct msm_vidc_core *core)
 {
 	int rc = 0;
 
-	if (!core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	} else if (!is_core_sub_state(core, CORE_SUBSTATE_POWER_ENABLE)) {
+	if (!is_core_sub_state(core, CORE_SUBSTATE_POWER_ENABLE)) {
 		d_vpr_h("Power already disabled\n");
 		return 0;
 	}
@@ -513,10 +490,7 @@ static int __resume(struct msm_vidc_core *core)
 {
 	int rc = 0;
 
-	if (!core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	} else if (is_core_sub_state(core, CORE_SUBSTATE_POWER_ENABLE)) {
+	if (is_core_sub_state(core, CORE_SUBSTATE_POWER_ENABLE)) {
 		goto exit;
 	} else if (!core_in_valid_state(core)) {
 		d_vpr_e("%s: core not in valid state\n", __func__);
@@ -726,10 +700,6 @@ void venus_hfi_pm_work_handler(struct work_struct *work)
 	struct msm_vidc_core *core;
 
 	core = container_of(work, struct msm_vidc_core, pm_work.work);
-	if (!core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return;
-	}
 
 	core_lock(core, __func__);
 	d_vpr_h("%s: try power collapse\n", __func__);
@@ -818,11 +788,6 @@ int venus_hfi_core_init(struct msm_vidc_core *core)
 {
 	int rc = 0;
 
-	if (!core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	d_vpr_h("%s(): core %pK\n", __func__, core);
 
 	rc = __strict_check(core, __func__);
@@ -880,11 +845,6 @@ int venus_hfi_core_deinit(struct msm_vidc_core *core, bool force)
 {
 	int rc = 0;
 
-	if (!core) {
-		d_vpr_h("%s(): invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	d_vpr_h("%s(): core %pK\n", __func__, core);
 	rc = __strict_check(core, __func__);
 	if (rc)
@@ -911,12 +871,6 @@ int venus_hfi_noc_error_info(struct msm_vidc_core *core)
 {
 	int rc = 0;
 
-	if (!core) {
-		d_vpr_e("%s: Invalid parameters: %pK\n",
-			__func__, core);
-		return -EINVAL;
-	}
-
 	if (!core->capabilities[NON_FATAL_FAULTS].value)
 		return 0;
 
@@ -942,11 +896,6 @@ int venus_hfi_suspend(struct msm_vidc_core *core)
 {
 	int rc = 0;
 
-	if (!core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	rc = __strict_check(core, __func__);
 	if (rc)
 		return rc;
@@ -975,11 +924,6 @@ int venus_hfi_trigger_ssr(struct msm_vidc_core *core, u32 type,
 	int rc = 0;
 	u32 payload[2];
 
-	if (!core || !core->packet) {
-		d_vpr_e("%s: Invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	/*
 	 * call resume before preparing ssr hfi packet in core->packet
 	 * otherwise ssr hfi packet in core->packet will be overwritten

+ 0 - 16
driver/vidc/src/venus_hfi_queue.c

@@ -270,12 +270,6 @@ static int __iface_cmdq_write_relaxed(struct msm_vidc_core *core,
 	//struct vidc_hal_cmd_pkt_hdr *cmd_packet;
 	int rc = -E2BIG;
 
-	if (!core || !pkt) {
-		d_vpr_e("%s: invalid params %pK %pK\n",
-			__func__, core, pkt);
-		return -EINVAL;
-	}
-
 	rc = __strict_check(core, __func__);
 	if (rc)
 		return rc;
@@ -458,11 +452,6 @@ int venus_hfi_reset_queue_header(struct msm_vidc_core *core)
 	struct hfi_queue_header *q_hdr;
 	int i, rc = 0;
 
-	if (!core) {
-		d_vpr_e("%s: invalid param\n", __func__);
-		return -EINVAL;
-	}
-
 	for (i = 0; i < VIDC_IFACEQ_NUMQ; i++) {
 		iface_q = &core->iface_queues[i];
 		__set_queue_hdr_defaults(iface_q->q_hdr);
@@ -544,11 +533,6 @@ int venus_hfi_queue_init(struct msm_vidc_core *core)
 
 	d_vpr_h("%s: initializing interface queue\n", __func__);
 
-	if (!core) {
-		d_vpr_h("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	if (core->iface_q_table.align_virtual_addr) {
 		d_vpr_h("%s: queues already allocated\n", __func__);
 		venus_hfi_reset_queue_header(core);

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

@@ -212,11 +212,6 @@ static int validate_hdr_packet(struct msm_vidc_core *core,
 	u8 *pkt;
 	int i, rc = 0;
 
-	if (!core || !hdr || !function) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	if (hdr->size < sizeof(struct hfi_header) + sizeof(struct hfi_packet)) {
 		d_vpr_e("%s: invalid header size %d\n", __func__, hdr->size);
 		return -EINVAL;
@@ -395,10 +390,6 @@ void fw_coredump(struct msm_vidc_core *core)
 	char *data = NULL, *dump = NULL;
 	u64 total_size;
 
-	if (!core) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return;
-	}
 	pdev = core->pdev;
 
 	node = of_parse_phandle(pdev->dev.of_node, "memory-region", 0);
@@ -2075,11 +2066,6 @@ int handle_response(struct msm_vidc_core *core, void *response)
 	struct hfi_header *hdr;
 	int rc = 0;
 
-	if (!core || !response) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
 	hdr = (struct hfi_header *)response;
 	rc = validate_hdr_packet(core, hdr, __func__);
 	if (rc) {