video: driver: free children and firmware list memory
To avoid memory leakage, clean children and firmware lists at session close, error cases, and at the end of each usage. Change-Id: I1eadbf81da207bd987c50428c0c7cf4967a8885f Signed-off-by: Akshata Sahukar <asahukar@codeaurora.org>
This commit is contained in:
@@ -10,11 +10,6 @@
|
|||||||
#include "msm_vidc_inst.h"
|
#include "msm_vidc_inst.h"
|
||||||
#include "msm_vidc_internal.h"
|
#include "msm_vidc_internal.h"
|
||||||
|
|
||||||
enum msm_vidc_ctrl_list_type {
|
|
||||||
CHILD_LIST = BIT(0),
|
|
||||||
FW_LIST = BIT(1),
|
|
||||||
};
|
|
||||||
|
|
||||||
int msm_vidc_ctrl_init(struct msm_vidc_inst *inst);
|
int msm_vidc_ctrl_init(struct msm_vidc_inst *inst);
|
||||||
int msm_vidc_ctrl_deinit(struct msm_vidc_inst *inst);
|
int msm_vidc_ctrl_deinit(struct msm_vidc_inst *inst);
|
||||||
int msm_v4l2_op_s_ctrl(struct v4l2_ctrl *ctrl);
|
int msm_v4l2_op_s_ctrl(struct v4l2_ctrl *ctrl);
|
||||||
|
@@ -387,5 +387,7 @@ int msm_vidc_check_session_supported(struct msm_vidc_inst *inst);
|
|||||||
int msm_vidc_check_mbps_supported(struct msm_vidc_inst *inst);
|
int msm_vidc_check_mbps_supported(struct msm_vidc_inst *inst);
|
||||||
int msm_vidc_check_scaling_supported(struct msm_vidc_inst *inst);
|
int msm_vidc_check_scaling_supported(struct msm_vidc_inst *inst);
|
||||||
const char *buf_name(enum msm_vidc_buffer_type type);
|
const char *buf_name(enum msm_vidc_buffer_type type);
|
||||||
|
void msm_vidc_free_capabililty_list(struct msm_vidc_inst *inst,
|
||||||
|
enum msm_vidc_ctrl_list_type list_type);
|
||||||
#endif // _MSM_VIDC_DRIVER_H_
|
#endif // _MSM_VIDC_DRIVER_H_
|
||||||
|
|
||||||
|
@@ -292,6 +292,11 @@ enum msm_vidc_matrix_coefficients {
|
|||||||
MSM_VIDC_MATRIX_COEFF_BT2100 = 14,
|
MSM_VIDC_MATRIX_COEFF_BT2100 = 14,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum msm_vidc_ctrl_list_type {
|
||||||
|
CHILD_LIST = BIT(0),
|
||||||
|
FW_LIST = BIT(1),
|
||||||
|
};
|
||||||
|
|
||||||
enum msm_vidc_core_capability_type {
|
enum msm_vidc_core_capability_type {
|
||||||
CORE_CAP_NONE = 0,
|
CORE_CAP_NONE = 0,
|
||||||
ENC_CODECS,
|
ENC_CODECS,
|
||||||
|
@@ -757,6 +757,9 @@ int msm_v4l2_op_s_ctrl(struct v4l2_ctrl *ctrl)
|
|||||||
}
|
}
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
if (rc)
|
||||||
|
msm_vidc_free_capabililty_list(inst, CHILD_LIST | FW_LIST);
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1817,6 +1820,9 @@ int msm_vidc_adjust_v4l2_properties(struct msm_vidc_inst *inst)
|
|||||||
}
|
}
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
if (rc)
|
||||||
|
msm_vidc_free_capabililty_list(inst, CHILD_LIST | FW_LIST);
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2742,6 +2748,8 @@ int msm_vidc_set_v4l2_properties(struct msm_vidc_inst *inst)
|
|||||||
}
|
}
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
msm_vidc_free_capabililty_list(inst, FW_LIST);
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -2561,6 +2561,31 @@ static void msm_vidc_free_input_cr_list(struct msm_vidc_inst *inst)
|
|||||||
INIT_LIST_HEAD(&inst->enc_input_crs);
|
INIT_LIST_HEAD(&inst->enc_input_crs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void msm_vidc_free_capabililty_list(struct msm_vidc_inst *inst,
|
||||||
|
enum msm_vidc_ctrl_list_type list_type)
|
||||||
|
{
|
||||||
|
struct msm_vidc_inst_cap_entry *temp = NULL, *next = NULL;
|
||||||
|
|
||||||
|
if (list_type & CHILD_LIST) {
|
||||||
|
list_for_each_entry_safe(temp, next, &inst->children.list, list) {
|
||||||
|
list_del(&temp->list);
|
||||||
|
kfree(temp);
|
||||||
|
}
|
||||||
|
INIT_LIST_HEAD(&inst->children.list);
|
||||||
|
}
|
||||||
|
|
||||||
|
temp = NULL;
|
||||||
|
next = NULL;
|
||||||
|
|
||||||
|
if (list_type & FW_LIST) {
|
||||||
|
list_for_each_entry_safe(temp, next, &inst->firmware.list, list) {
|
||||||
|
list_del(&temp->list);
|
||||||
|
kfree(temp);
|
||||||
|
}
|
||||||
|
INIT_LIST_HEAD(&inst->firmware.list);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static int msm_vidc_queue_buffer(struct msm_vidc_inst *inst, struct msm_vidc_buffer *buf)
|
static int msm_vidc_queue_buffer(struct msm_vidc_inst *inst, struct msm_vidc_buffer *buf)
|
||||||
{
|
{
|
||||||
struct msm_vidc_buffer *meta;
|
struct msm_vidc_buffer *meta;
|
||||||
@@ -4263,6 +4288,7 @@ static void msm_vidc_close_helper(struct kref *kref)
|
|||||||
else if (is_encode_session(inst))
|
else if (is_encode_session(inst))
|
||||||
msm_venc_inst_deinit(inst);
|
msm_venc_inst_deinit(inst);
|
||||||
msm_vidc_free_input_cr_list(inst);
|
msm_vidc_free_input_cr_list(inst);
|
||||||
|
msm_vidc_free_capabililty_list(inst, CHILD_LIST | FW_LIST);
|
||||||
kfree(inst->capabilities);
|
kfree(inst->capabilities);
|
||||||
if (inst->response_workq)
|
if (inst->response_workq)
|
||||||
destroy_workqueue(inst->response_workq);
|
destroy_workqueue(inst->response_workq);
|
||||||
|
Reference in New Issue
Block a user