|
@@ -1117,7 +1117,7 @@ static int cam_vfe_top_apply_fcg_update(
|
|
uint32_t num_regval_pairs = 0;
|
|
uint32_t num_regval_pairs = 0;
|
|
int rc = 0, i, j = 0;
|
|
int rc = 0, i, j = 0;
|
|
|
|
|
|
- if (!top_priv || (fcg_update->prediction_idx == 0)) {
|
|
|
|
|
|
+ if (!top_priv || !fcg_update || (fcg_update->prediction_idx == 0)) {
|
|
CAM_ERR(CAM_ISP, "Invalid args");
|
|
CAM_ERR(CAM_ISP, "Invalid args");
|
|
return -EINVAL;
|
|
return -EINVAL;
|
|
}
|
|
}
|
|
@@ -1135,6 +1135,12 @@ static int cam_vfe_top_apply_fcg_update(
|
|
return -EINVAL;
|
|
return -EINVAL;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ if (fcg_config->num_ch_ctx > CAM_ISP_MAX_FCG_CH_CTXS) {
|
|
|
|
+ CAM_ERR(CAM_SFE, "out of bounds %d",
|
|
|
|
+ fcg_config->num_ch_ctx);
|
|
|
|
+ return -EINVAL;
|
|
|
|
+ }
|
|
|
|
+
|
|
reg_val_pair = kcalloc(fcg_module_info->max_reg_val_pair_size, sizeof(uint32_t),
|
|
reg_val_pair = kcalloc(fcg_module_info->max_reg_val_pair_size, sizeof(uint32_t),
|
|
GFP_KERNEL);
|
|
GFP_KERNEL);
|
|
if (!reg_val_pair) {
|
|
if (!reg_val_pair) {
|
|
@@ -1143,19 +1149,20 @@ static int cam_vfe_top_apply_fcg_update(
|
|
}
|
|
}
|
|
|
|
|
|
fcg_index_shift = fcg_module_info->fcg_index_shift;
|
|
fcg_index_shift = fcg_module_info->fcg_index_shift;
|
|
|
|
+
|
|
for (i = 0, j = 0; i < fcg_config->num_ch_ctx; i++) {
|
|
for (i = 0, j = 0; i < fcg_config->num_ch_ctx; i++) {
|
|
if (j >= fcg_module_info->max_reg_val_pair_size) {
|
|
if (j >= fcg_module_info->max_reg_val_pair_size) {
|
|
CAM_ERR(CAM_ISP, "reg_val_pair %d exceeds the array limit %u",
|
|
CAM_ERR(CAM_ISP, "reg_val_pair %d exceeds the array limit %u",
|
|
j, fcg_module_info->max_reg_val_pair_size);
|
|
j, fcg_module_info->max_reg_val_pair_size);
|
|
rc = -ENOMEM;
|
|
rc = -ENOMEM;
|
|
- goto kfree;
|
|
|
|
|
|
+ goto free_mem;
|
|
}
|
|
}
|
|
|
|
|
|
fcg_ch_ctx = &fcg_config->ch_ctx_fcg_configs[i];
|
|
fcg_ch_ctx = &fcg_config->ch_ctx_fcg_configs[i];
|
|
if (!fcg_ch_ctx) {
|
|
if (!fcg_ch_ctx) {
|
|
CAM_ERR(CAM_ISP, "Failed in FCG channel/context dereference");
|
|
CAM_ERR(CAM_ISP, "Failed in FCG channel/context dereference");
|
|
rc = -EINVAL;
|
|
rc = -EINVAL;
|
|
- goto kfree;
|
|
|
|
|
|
+ goto free_mem;
|
|
}
|
|
}
|
|
|
|
|
|
fcg_pr = &fcg_ch_ctx->predicted_fcg_configs[
|
|
fcg_pr = &fcg_ch_ctx->predicted_fcg_configs[
|
|
@@ -1200,7 +1207,7 @@ static int cam_vfe_top_apply_fcg_update(
|
|
"No support for multi context for FCG on ch_ctx_id: 0x%x",
|
|
"No support for multi context for FCG on ch_ctx_id: 0x%x",
|
|
fcg_ch_ctx->fcg_ch_ctx_id);
|
|
fcg_ch_ctx->fcg_ch_ctx_id);
|
|
rc = -EINVAL;
|
|
rc = -EINVAL;
|
|
- goto kfree;
|
|
|
|
|
|
+ goto free_mem;
|
|
}
|
|
}
|
|
|
|
|
|
CAM_VFE_ADD_REG_VAL_PAIR(reg_val_pair, j,
|
|
CAM_VFE_ADD_REG_VAL_PAIR(reg_val_pair, j,
|
|
@@ -1233,7 +1240,7 @@ static int cam_vfe_top_apply_fcg_update(
|
|
CAM_ERR(CAM_ISP, "Unsupported ch_ctx_id: 0x%x",
|
|
CAM_ERR(CAM_ISP, "Unsupported ch_ctx_id: 0x%x",
|
|
fcg_ch_ctx->fcg_ch_ctx_id);
|
|
fcg_ch_ctx->fcg_ch_ctx_id);
|
|
rc = -EINVAL;
|
|
rc = -EINVAL;
|
|
- goto kfree;
|
|
|
|
|
|
+ goto free_mem;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -1249,7 +1256,7 @@ static int cam_vfe_top_apply_fcg_update(
|
|
"Failed! Buf size:%d is wrong, expected size: %d",
|
|
"Failed! Buf size:%d is wrong, expected size: %d",
|
|
fcg_update->cmd_size, size * 4);
|
|
fcg_update->cmd_size, size * 4);
|
|
rc = -ENOMEM;
|
|
rc = -ENOMEM;
|
|
- goto kfree;
|
|
|
|
|
|
+ goto free_mem;
|
|
}
|
|
}
|
|
|
|
|
|
cdm_util_ops->cdm_write_regrandom(
|
|
cdm_util_ops->cdm_write_regrandom(
|
|
@@ -1259,7 +1266,7 @@ static int cam_vfe_top_apply_fcg_update(
|
|
CAM_WARN(CAM_ISP, "No reg val pairs");
|
|
CAM_WARN(CAM_ISP, "No reg val pairs");
|
|
}
|
|
}
|
|
|
|
|
|
-kfree:
|
|
|
|
|
|
+free_mem:
|
|
kfree(reg_val_pair);
|
|
kfree(reg_val_pair);
|
|
return rc;
|
|
return rc;
|
|
}
|
|
}
|
|
@@ -1320,7 +1327,7 @@ static int cam_vfe_top_fcg_config(
|
|
int rc;
|
|
int rc;
|
|
|
|
|
|
if (arg_size != sizeof(struct cam_isp_hw_fcg_cmd)) {
|
|
if (arg_size != sizeof(struct cam_isp_hw_fcg_cmd)) {
|
|
- CAM_ERR(CAM_ISP, "Invalid cmd size, arg_size: %d, expected size: %d",
|
|
|
|
|
|
+ CAM_ERR(CAM_ISP, "Invalid cmd size, arg_size: %u, expected size: %u",
|
|
arg_size, sizeof(struct cam_isp_hw_fcg_cmd));
|
|
arg_size, sizeof(struct cam_isp_hw_fcg_cmd));
|
|
return -EINVAL;
|
|
return -EINVAL;
|
|
}
|
|
}
|
|
@@ -1358,8 +1365,8 @@ int cam_vfe_top_ver4_process_cmd(void *device_priv, uint32_t cmd_type,
|
|
{
|
|
{
|
|
int rc = 0;
|
|
int rc = 0;
|
|
struct cam_vfe_top_ver4_priv *top_priv;
|
|
struct cam_vfe_top_ver4_priv *top_priv;
|
|
- struct cam_hw_soc_info *soc_info = NULL;
|
|
|
|
- struct cam_vfe_soc_private *soc_private = NULL;
|
|
|
|
|
|
+ struct cam_hw_soc_info *soc_info;
|
|
|
|
+ struct cam_vfe_soc_private *soc_private;
|
|
|
|
|
|
if (!device_priv || !cmd_args) {
|
|
if (!device_priv || !cmd_args) {
|
|
CAM_ERR(CAM_ISP, "Error, Invalid arguments");
|
|
CAM_ERR(CAM_ISP, "Error, Invalid arguments");
|