{
int ret = 0;
char *cmdline = NULL;
+ char *str_param = NULL;
+ char *tmp = NULL;
int width = 0;
int height = 0;
| BIT_MASK(EV_ABS)
| BIT_MASK(EV_MSC);
- cmdline = strstr(saved_command_line, CMDLINE_VIDEO_PARAM);
- if (cmdline != NULL) {
- char *tmp;
- cmdline += strlen(CMDLINE_VIDEO_PARAM);
- tmp = strsep(&cmdline, "x");
+ cmdline = kzalloc(strlen(saved_command_line) + 1, GFP_KERNEL);
+ if (cmdline == NULL) {
+ printk(KERN_WARNING "[%s] cannot fine the kernel command line\n",
+ DEVICE_NAME);
+ goto default_resolution;
+ }
+
+ strcpy(cmdline, saved_command_line);
+ str_param = strstr(cmdline, CMDLINE_VIDEO_PARAM);
+ if (str_param == NULL) {
+ printk(KERN_WARNING "[%s] cannot find the video resolution(%s) "
+ "in the kernel command line\n",
+ DEVICE_NAME, CMDLINE_VIDEO_PARAM);
+ goto default_resolution;
+ }
+
+ str_param += strlen(CMDLINE_VIDEO_PARAM);
+ tmp = strsep(&str_param, "x");
+ if (tmp != NULL) {
+ ret = kstrtoint(tmp, 10, &width);
+ if (ret) {
+ printk(KERN_WARNING "[%s] cannot find the width value\n",
+ DEVICE_NAME);
+ width = 0;
+ goto default_resolution;
+ }
+
+ tmp = strsep(&str_param, "-");
if (tmp != NULL) {
- ret = kstrtoint(tmp, 10, &width);
+ ret = kstrtoint(tmp, 10, &height);
if (ret) {
- printk(KERN_WARNING "cannot find the width value\n");
- width = 0;
- }
-
- tmp = strsep(&cmdline, "-");
- if (tmp != NULL) {
- ret = kstrtoint(tmp, 10, &height);
- if (ret) {
- printk(KERN_WARNING "cannot find the height value\n");
- height = 0;
- }
- } else {
- printk(KERN_WARNING "Invalid bpp separator:"
- " cannot find the height value\n");
+ printk(KERN_WARNING "[%s] cannot find the height value\n",
+ DEVICE_NAME);
+ height = width = 0;
+ goto default_resolution;
}
} else {
- printk(KERN_WARNING "Invalid resolution separator: "
- " cannot find the width value\n");
+ printk(KERN_WARNING "[%s] Invalid bpp separator:"
+ " cannot find the height value\n", DEVICE_NAME);
}
} else {
- printk(KERN_WARNING "cannot find the video parameter(%s) "
- "in the kernel command line\n", CMDLINE_VIDEO_PARAM);
+ printk(KERN_WARNING "[%s] Invalid resolution separator: "
+ " cannot find the width value\n", DEVICE_NAME);
}
+default_resolution:
+ kfree(cmdline);
if (!width || !height) {
width = DEFAULT_WIDTH;
height = DEFAULT_HEIGHT;
- printk(KERN_WARNING "cannot find the width or height, "
- "use default values %dx%d\n", width, height);
+ printk(KERN_WARNING "[%s] cannot find the width or height, "
+ "use default values %dx%d\n", DEVICE_NAME, width, height);
}
input_set_abs_params(vtb->idev, ABS_X, 0, width, 0, 0);