{
int ret;
- if (local_cvbs_mode >= MODE_MAX)
- cvbs_log_err("cvbs_out_setmode:cvbsmode error.");
- mutex_lock(&setmode_mutex);
cvbs_log_info("SET cvbs mode:%s(%d)\n",
(local_cvbs_mode == 0) ? "480cvbs" :
((local_cvbs_mode == 1) ? "576cvbs" :
"invalid"), local_cvbs_mode);
+ if (local_cvbs_mode >= MODE_MAX) {
+ cvbs_log_err("cvbs_out_setmode:cvbsmode error.");
+ return -1;
+ }
+ mutex_lock(&setmode_mutex);
cvbs_out_vpu_power_ctrl(1);
cvbs_out_clk_gate_ctrl(1);
for (i = 0; i < count; i++) {
if (strncmp(cvbs_info[i].name, mode,
strlen(cvbs_info[i].name)) == 0) {
- if ((vinfo == NULL)
- || (strlen(cvbs_info[i].name) > mode_name_len)) {
+ if (strlen(cvbs_info[i].name) > mode_name_len) {
vinfo = &cvbs_info[i];
mode_name_len = strlen(cvbs_info[i].name);
local_cvbs_mode = i;
}
}
if (vinfo)
- strcpy(vinfo->ext_name, mode);
+ strncpy(vinfo->ext_name, mode,
+ (strlen(mode) < 32) ? strlen(mode) : 31);
else
local_cvbs_mode = MODE_MAX;
return vinfo;
"\tclkdump\n"
"\tset_clkpath 0/1/2/3\n");
break;
- default:
- break;
}
DEBUG_END:
cdev_del(info->cdev);
fail_add_cdev:
cvbs_log_info("[cvbs.] : cvbs add device error.\n");
- kfree(info);
fail_class_create_file:
cvbs_log_info("[cvbs.] : cvbs class create file error.\n");
for (i = 0; i < ARRAY_SIZE(cvbs_attr); i++)
else if (cmd == WSS_480I_CMD_OFF)
wss_close_output(480);
else {
- if ((cmd >= WSS_576I_CMD_AR) && (cmd <= WSS_576I_CMD_OFF))
+ if (cmd <= WSS_576I_CMD_OFF)
mode = 576;
else if ((cmd >= WSS_480I_CMD_AR) && (cmd <= WSS_480I_CMD_OFF))
mode = 480;
/* pr_info("[%s] mode = %d, wss_cmd = |%s|\n", __FUNCTION__, mode, wss_cmd); */
if (mode == MODE_576CVBS) {
if (!strncmp(wss_cmd, "cgms", strlen("cgms"))) {
- data = (data>>WSS_576I_CGMS_A_START) &
+ data = (data >> WSS_576I_CGMS_A_START) &
WSS_576I_CGMS_A_MASK;
switch (data) {
case 0:
case 3:
pr_info("cgms 3: copy right asserted / copying restricted\n");
break;
- default:
- break;
}
}
}
cmd = 0xee;
else {
if (get_local_cvbs_mode() == MODE_480CVBS) {
- cmd_max = sizeof(wss_480i_cmd);
+ cmd_max = sizeof(wss_480i_cmd)/sizeof(char *);
for (i = 0; i < cmd_max; i++) {
if (!strncmp(argv[0], wss_480i_cmd[i],
strlen(wss_480i_cmd[i]))) {
}
}
} else if (get_local_cvbs_mode() == MODE_576CVBS) {
- cmd_max = sizeof(wss_576i_cmd);
+ cmd_max = sizeof(wss_576i_cmd)/sizeof(char *);
for (i = 0; i < cmd_max; i++) {
if (!strncmp(argv[0], wss_576i_cmd[i],
strlen(wss_576i_cmd[i]))) {