diff --git a/drivers/media/platform/msm/vidc/msm_vidc_common.c b/drivers/media/platform/msm/vidc/msm_vidc_common.c index ee3cfb88855c..c3f558b4334e 100644 --- a/drivers/media/platform/msm/vidc/msm_vidc_common.c +++ b/drivers/media/platform/msm/vidc/msm_vidc_common.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved. +/* Copyright (c) 2012-2019, 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 @@ -1478,7 +1478,7 @@ void validate_output_buffers(struct msm_vidc_inst *inst) } mutex_lock(&inst->outputbufs.lock); list_for_each_entry(binfo, &inst->outputbufs.list, list) { - if (binfo->buffer_ownership != DRIVER) { + if (binfo && binfo->buffer_ownership != DRIVER) { dprintk(VIDC_DBG, "This buffer is with FW %pa\n", &binfo->handle->device_addr); @@ -3175,8 +3175,7 @@ static int set_output_buffers(struct msm_vidc_inst *inst, if (!handle) { dprintk(VIDC_ERR, "Failed to allocate output memory\n"); - rc = -ENOMEM; - goto err_no_mem; + return -ENOMEM; } rc = msm_comm_smem_cache_operations(inst, handle, SMEM_CACHE_CLEAN, -1); @@ -3228,10 +3227,9 @@ static int set_output_buffers(struct msm_vidc_inst *inst, } return rc; fail_set_buffers: - msm_comm_smem_free(inst, handle); -err_no_mem: kfree(binfo); fail_kzalloc: + msm_comm_smem_free(inst, handle); return rc; }