diff options
| -rw-r--r-- | drivers/media/platform/msm/vidc/venus_hfi.c | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/drivers/media/platform/msm/vidc/venus_hfi.c b/drivers/media/platform/msm/vidc/venus_hfi.c index 18ad1584c8b3..7e6b1071b038 100644 --- a/drivers/media/platform/msm/vidc/venus_hfi.c +++ b/drivers/media/platform/msm/vidc/venus_hfi.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2012-2019, The Linux Foundation. All rights reserved. +/* Copyright (c) 2012-2020, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -3367,9 +3367,11 @@ exit: return; } -static void __process_sys_error(struct venus_hfi_device *device) +static void print_sfr_message(struct venus_hfi_device *device) { struct hfi_sfr_struct *vsfr = NULL; + u32 vsfr_size = 0; + void *p = NULL; /* Once SYS_ERROR received from HW, it is safe to halt the AXI. * With SYS_ERROR, Venus FW may have crashed and HW might be @@ -3380,12 +3382,11 @@ static void __process_sys_error(struct venus_hfi_device *device) vsfr = (struct hfi_sfr_struct *)device->sfr.align_virtual_addr; if (vsfr) { - void *p = memchr(vsfr->rg_data, '\0', vsfr->bufSize); - /* SFR isn't guaranteed to be NULL terminated - since SYS_ERROR indicates that Venus is in the - process of crashing.*/ + vsfr_size = vsfr->bufSize - sizeof(u32); + p = memchr(vsfr->rg_data, '\0', vsfr_size); + /* SFR isn't guaranteed to be NULL terminated */ if (p == NULL) - vsfr->rg_data[vsfr->bufSize - 1] = '\0'; + vsfr->rg_data[vsfr_size - 1] = '\0'; dprintk(VIDC_ERR, "SFR Message from FW: %s\n", vsfr->rg_data); @@ -3509,8 +3510,6 @@ static int __response_handler(struct venus_hfi_device *device) } if (device->intr_status & VIDC_WRAPPER_INTR_CLEAR_A2HWD_BMSK) { - struct hfi_sfr_struct *vsfr = (struct hfi_sfr_struct *) - device->sfr.align_virtual_addr; struct msm_vidc_cb_info info = { .response_type = HAL_SYS_WATCHDOG_TIMEOUT, .response.cmd = { @@ -3518,9 +3517,7 @@ static int __response_handler(struct venus_hfi_device *device) } }; - if (vsfr) - dprintk(VIDC_ERR, "SFR Message from FW: %s\n", - vsfr->rg_data); + print_sfr_message(device); dprintk(VIDC_ERR, "Received watchdog timeout\n"); packets[packet_count++] = info; @@ -3546,7 +3543,7 @@ static int __response_handler(struct venus_hfi_device *device) /* Process the packet types that we're interested in */ switch (info->response_type) { case HAL_SYS_ERROR: - __process_sys_error(device); + print_sfr_message(device); break; case HAL_SYS_RELEASE_RESOURCE_DONE: dprintk(VIDC_DBG, "Received SYS_RELEASE_RESOURCE\n"); |
