msm: vidc: Correct error handling for allocation failure cases
In error handling, trying to free memory which is not yet allocated. Fix is added to correct this error handling. Change-Id: I4e91a95f7ebd9132141d8686ae2bdfaed3a9a8c1 Signed-off-by: Sanjay Singh <sisanj@codeaurora.org> Signed-off-by: Vasantha Balla <vballa@codeaurora.org>
This commit is contained in:
parent
8b4d96792a
commit
2eae84f039
1 changed files with 4 additions and 6 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue