Browse Source

video: driver: null check in handling sys error

add null check for pkt before accessing pkt
type in handle_system_error function.

Change-Id: If2c3d4c789fed16ed5c385258edc20e122bf1ea9
Signed-off-by: Darshana Patil <[email protected]>
Darshana Patil 4 years ago
parent
commit
371fcbad4e
1 changed files with 13 additions and 11 deletions
  1. 13 11
      driver/vidc/src/venus_hfi_response.c

+ 13 - 11
driver/vidc/src/venus_hfi_response.c

@@ -448,17 +448,19 @@ int handle_system_error(struct msm_vidc_core *core,
 	print_sfr_message(core);
 	print_sfr_message(core);
 	venus_hfi_noc_error_info(core);
 	venus_hfi_noc_error_info(core);
 
 
-	/* enable force bugon for requested type */
-	if (pkt->type == HFI_SYS_ERROR_FATAL)
-		bug_on = !!(msm_vidc_enable_bugon & MSM_VIDC_BUG_ON_FATAL);
-	else if (pkt->type == HFI_SYS_ERROR_NOC)
-		bug_on = !!(msm_vidc_enable_bugon & MSM_VIDC_BUG_ON_NOC);
-	else if (pkt->type == HFI_SYS_ERROR_WD_TIMEOUT)
-		bug_on = !!(msm_vidc_enable_bugon & MSM_VIDC_BUG_ON_WD_TIMEOUT);
-
-	if (bug_on) {
-		d_vpr_e("%s: force bugon for type %#x\n", __func__, pkt->type);
-		MSM_VIDC_FATAL(true);
+	if (pkt) {
+		/* enable force bugon for requested type */
+		if (pkt->type == HFI_SYS_ERROR_FATAL)
+			bug_on = !!(msm_vidc_enable_bugon & MSM_VIDC_BUG_ON_FATAL);
+		else if (pkt->type == HFI_SYS_ERROR_NOC)
+			bug_on = !!(msm_vidc_enable_bugon & MSM_VIDC_BUG_ON_NOC);
+		else if (pkt->type == HFI_SYS_ERROR_WD_TIMEOUT)
+			bug_on = !!(msm_vidc_enable_bugon & MSM_VIDC_BUG_ON_WD_TIMEOUT);
+
+		if (bug_on) {
+			d_vpr_e("%s: force bugon for type %#x\n", __func__, pkt->type);
+			MSM_VIDC_FATAL(true);
+		}
 	}
 	}
 
 
 	msm_vidc_core_deinit(core, true);
 	msm_vidc_core_deinit(core, true);