summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjinhyung.jo <jinhyung.jo@samsung.com>2015-10-27 14:42:24 +0900
committerJinhyung Jo <jinhyung.jo@samsung.com>2016-10-18 16:50:05 +0900
commit1e970d8f70430f8f2f22ed99568776ca306b7574 (patch)
treee36e733762d596543ec432a2e35ece781ed2d83a
parent5e587f9a0cc20335ca3a38ffea4519b9aa5e111e (diff)
downloademulator-kernel-1e970d8f70430f8f2f22ed99568776ca306b7574.tar.gz
emulator-kernel-1e970d8f70430f8f2f22ed99568776ca306b7574.tar.bz2
emulator-kernel-1e970d8f70430f8f2f22ed99568776ca306b7574.zip
tablet: Bug fix for the kernel command breaking
When getting the display resolution, some parameters are missing. Because the driver directly uses the address of the kernel command line. So it copies the kernel command line to temporary buffer and uses it. And added some modification for the logs. Change-Id: If8cffbed1cbb81200bf46ade862a5f38e0c3914c Signed-off-by: Jinhyung Jo <jinhyung.jo@samsung.com> (cherry picked from commit 9c4925034c0d3a474c51c7760e7fdd8f3637624c)
-rw-r--r--drivers/maru/maru_virtio_tablet.c69
1 files changed, 43 insertions, 26 deletions
diff --git a/drivers/maru/maru_virtio_tablet.c b/drivers/maru/maru_virtio_tablet.c
index ef22ebccb64c..ee8f258c1b2f 100644
--- a/drivers/maru/maru_virtio_tablet.c
+++ b/drivers/maru/maru_virtio_tablet.c
@@ -162,6 +162,8 @@ static int virtio_tablet_probe(struct virtio_device *vdev)
{
int ret = 0;
char *cmdline = NULL;
+ char *str_param = NULL;
+ char *tmp = NULL;
int width = 0;
int height = 0;
@@ -213,44 +215,59 @@ static int virtio_tablet_probe(struct virtio_device *vdev)
| 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);