aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input
diff options
context:
space:
mode:
authorOliver Neukum <oliver@neukum.org>2008-04-04 15:31:47 -0400
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2008-04-04 15:31:47 -0400
commit76d057ce5a48034c97f604a0a25a87093e072c71 (patch)
treee78405f86b813f288c4c8af2b00f5aa231d08d98 /drivers/input
parentf0fab8e04dfe79376b410b48c817f5fe921b345b (diff)
Input: usbtouchscreen - don't use DMA on stack
DMA on the stack is not allowed. The buffer must be kmalloced. Signed-off-by: Oliver Neukum <oneukum@suse.de> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/input')
-rw-r--r--drivers/input/touchscreen/usbtouchscreen.c31
1 files changed, 19 insertions, 12 deletions
diff --git a/drivers/input/touchscreen/usbtouchscreen.c b/drivers/input/touchscreen/usbtouchscreen.c
index 63f9664a066f..3a0a8ca57076 100644
--- a/drivers/input/touchscreen/usbtouchscreen.c
+++ b/drivers/input/touchscreen/usbtouchscreen.c
@@ -396,9 +396,12 @@ static int gunze_read_data(struct usbtouch_usb *dev, unsigned char *pkt)
396static int dmc_tsc10_init(struct usbtouch_usb *usbtouch) 396static int dmc_tsc10_init(struct usbtouch_usb *usbtouch)
397{ 397{
398 struct usb_device *dev = usbtouch->udev; 398 struct usb_device *dev = usbtouch->udev;
399 int ret; 399 int ret = -ENOMEM;
400 unsigned char buf[2]; 400 unsigned char *buf;
401 401
402 buf = kmalloc(2, GFP_KERNEL);
403 if (!buf)
404 goto err_nobuf;
402 /* reset */ 405 /* reset */
403 buf[0] = buf[1] = 0xFF; 406 buf[0] = buf[1] = 0xFF;
404 ret = usb_control_msg(dev, usb_rcvctrlpipe (dev, 0), 407 ret = usb_control_msg(dev, usb_rcvctrlpipe (dev, 0),
@@ -406,9 +409,11 @@ static int dmc_tsc10_init(struct usbtouch_usb *usbtouch)
406 USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, 409 USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
407 0, 0, buf, 2, USB_CTRL_SET_TIMEOUT); 410 0, 0, buf, 2, USB_CTRL_SET_TIMEOUT);
408 if (ret < 0) 411 if (ret < 0)
409 return ret; 412 goto err_out;
410 if (buf[0] != 0x06 || buf[1] != 0x00) 413 if (buf[0] != 0x06 || buf[1] != 0x00) {
411 return -ENODEV; 414 ret = -ENODEV;
415 goto err_out;
416 }
412 417
413 /* set coordinate output rate */ 418 /* set coordinate output rate */
414 buf[0] = buf[1] = 0xFF; 419 buf[0] = buf[1] = 0xFF;
@@ -417,20 +422,22 @@ static int dmc_tsc10_init(struct usbtouch_usb *usbtouch)
417 USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, 422 USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
418 TSC10_RATE_150, 0, buf, 2, USB_CTRL_SET_TIMEOUT); 423 TSC10_RATE_150, 0, buf, 2, USB_CTRL_SET_TIMEOUT);
419 if (ret < 0) 424 if (ret < 0)
420 return ret; 425 goto err_out;
421 if ((buf[0] != 0x06 || buf[1] != 0x00) && 426 if ((buf[0] != 0x06 || buf[1] != 0x00) &&
422 (buf[0] != 0x15 || buf[1] != 0x01)) 427 (buf[0] != 0x15 || buf[1] != 0x01)) {
423 return -ENODEV; 428 ret = -ENODEV;
429 goto err_out;
430 }
424 431
425 /* start sending data */ 432 /* start sending data */
426 ret = usb_control_msg(dev, usb_rcvctrlpipe (dev, 0), 433 ret = usb_control_msg(dev, usb_rcvctrlpipe (dev, 0),
427 TSC10_CMD_DATA1, 434 TSC10_CMD_DATA1,
428 USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, 435 USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
429 0, 0, NULL, 0, USB_CTRL_SET_TIMEOUT); 436 0, 0, NULL, 0, USB_CTRL_SET_TIMEOUT);
430 if (ret < 0) 437err_out:
431 return ret; 438 kfree(buf);
432 439err_nobuf:
433 return 0; 440 return ret;
434} 441}
435 442
436 443