p_module = &vout2_module;
#endif
+ if (p_module == NULL) {
+ VOUTERR("vout%d: %s: vout_module is NULL\n", index, __func__);
+ mutex_unlock(&vout_mutex);
+ return;
+ }
list_for_each_entry(p_server, &p_module->vout_server_list, list) {
if (p_server->op.vmode_is_supported == NULL) {
p_server->op.disable(mode);
mutex_lock(&vout_mutex);
- if (index == 1)
+ if (index == 1) {
p_module = &vout_module;
+ mux_bit = 0;
+ clk_sel = 0;
+ } else if (index == 2) {
#ifdef CONFIG_AMLOGIC_VOUT2_SERVE
- else if (index == 2)
p_module = &vout2_module;
+ mux_bit = 2;
+ clk_sel = 1;
#endif
+ }
+ if (p_module == NULL) {
+ VOUTERR("vout%d: %s: vout_module is NULL\n", index, __func__);
+ mutex_unlock(&vout_mutex);
+ return;
+ }
p_server = p_module->curr_vout_server;
- if (p_server->op.get_vinfo)
- vinfo = p_server->op.get_vinfo();
+ if (p_server) {
+ if (p_server->op.get_vinfo)
+ vinfo = p_server->op.get_vinfo();
+ }
if (vinfo == NULL)
vinfo = get_invalid_vinfo(index);
- switch (index) {
- case 1:
- mux_bit = 0;
- clk_sel = 0;
- break;
- case 2:
- mux_bit = 2;
- clk_sel = 1;
- break;
- default:
- break;
- }
-
mux_sel = vinfo->viu_mux;
switch (mux_sel) {
case VIU_MUX_ENCL:
else if (index == 2)
p_module = &vout2_module;
#endif
+
+ if (p_module == NULL) {
+ VOUTERR("vout%d: %s: vout_module is NULL\n", index, __func__);
+ mutex_unlock(&vout_mutex);
+ return -1;
+ }
ret = p_module->curr_vout_server->op.set_vmode(mode);
mutex_unlock(&vout_mutex);
p_module = &vout2_module;
#endif
+ if (p_module == NULL) {
+ VOUTERR("vout%d: %s: vout_module is NULL\n", index, __func__);
+ mutex_unlock(&vout_mutex);
+ return VMODE_MAX;
+ }
list_for_each_entry(p_server, &p_module->vout_server_list, list) {
/* check state for another vout */
if (p_server->op.get_state) {
p_module = &vout2_module;
#endif
+ if (p_module == NULL) {
+ VOUTERR("vout%d: %s: vout_module is NULL\n", index, __func__);
+ return -1;
+ }
list_for_each_entry(p_server, &p_module->vout_server_list, list) {
if (p_server->op.vout_shutdown)
ret = p_server->op.vout_shutdown();
p_module = &vout2_module;
#endif
+ if (p_module == NULL) {
+ VOUTERR("vout%d: %s: vout_module is NULL\n", index, __func__);
+ mutex_unlock(&vout_mutex);
+ return -1;
+ }
list_for_each(p_iter, &p_module->vout_server_list) {
p_server = list_entry(p_iter, struct vout_server_s, list);
p_module = &vout2_module;
#endif
+ if (p_module == NULL) {
+ VOUTERR("vout%d: %s: vout_module is NULL\n", index, __func__);
+ mutex_unlock(&vout_mutex);
+ return -1;
+ }
list_for_each_entry(p_server, &p_module->vout_server_list, list) {
if (p_server->name && mem_server->name &&
(strcmp(p_server->name, mem_server->name) == 0)) {
char init_mode_str[VMODE_NAME_LEN_MAX];
int ret = 0;
- strncpy(init_mode_str, vout_mode_uboot, VMODE_NAME_LEN_MAX);
+ snprintf(init_mode_str, VMODE_NAME_LEN_MAX, "%s", vout_mode_uboot);
vout_init_vmode = validate_vmode(vout_mode_uboot);
if (vout_init_vmode >= VMODE_MAX) {
VOUTERR("no matched vout_init mode %s, force to invalid\n",
vout_mode_uboot);
nulldisp_index = 1;
vout_init_vmode = nulldisp_vinfo[nulldisp_index].mode;
- strncpy(init_mode_str, nulldisp_vinfo[nulldisp_index].name,
- VMODE_NAME_LEN_MAX);
+ snprintf(init_mode_str, VMODE_NAME_LEN_MAX, "%s",
+ nulldisp_vinfo[nulldisp_index].name);
}
last_vmode = vout_init_vmode;
hpd_state = vout_get_hpd_state();
if (hpd_state) {
cur_vmode = validate_vmode(hdmimode);
- strncpy(cur_mode_str, hdmimode, VMODE_NAME_LEN_MAX);
+ snprintf(cur_mode_str, VMODE_NAME_LEN_MAX, "%s", hdmimode);
} else {
cur_vmode = validate_vmode(cvbsmode);
- strncpy(cur_mode_str, cvbsmode, VMODE_NAME_LEN_MAX);
+ snprintf(cur_mode_str, VMODE_NAME_LEN_MAX, "%s", cvbsmode);
}
if (cur_vmode >= VMODE_MAX) {
VOUTERR("%s: no matched cur_mode: %s, force to invalid\n",
__func__, cur_mode_str);
nulldisp_index = 1;
cur_vmode = nulldisp_vinfo[nulldisp_index].mode;
- strncpy(cur_mode_str, nulldisp_vinfo[nulldisp_index].name,
- VMODE_NAME_LEN_MAX);
+ snprintf(cur_mode_str, VMODE_NAME_LEN_MAX, "%s",
+ nulldisp_vinfo[nulldisp_index].name);
}
/* not box platform */