From 4f74b5eba512f76a3fba3ed9efd106441f9a8e85 Mon Sep 17 00:00:00 2001 From: Rene van Paassen Date: Mon, 21 May 2007 00:31:59 -0400 Subject: [PATCH] --- yaml --- r: 58477 b: refs/heads/master c: 6125a400354c4a02b9dad0e5d8128f9dc08cfd51 h: refs/heads/master i: 58475: f4e3c7fe4194d8485ef615097f952343df545668 v: v3 --- [refs] | 2 +- trunk/drivers/input/tablet/aiptek.c | 28 ++++++++++++++++++++++------ 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/[refs] b/[refs] index 6648d36d163b..41176f06dc71 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 1a54f49e8989462cfc9cab0c377b2d4e60e5b70a +refs/heads/master: 6125a400354c4a02b9dad0e5d8128f9dc08cfd51 diff --git a/trunk/drivers/input/tablet/aiptek.c b/trunk/drivers/input/tablet/aiptek.c index 8c62afea5a52..7fb15af33c49 100644 --- a/trunk/drivers/input/tablet/aiptek.c +++ b/trunk/drivers/input/tablet/aiptek.c @@ -1670,17 +1670,23 @@ aiptek_probe(struct usb_interface *intf, const struct usb_device_id *id) aiptek = kzalloc(sizeof(struct aiptek), GFP_KERNEL); inputdev = input_allocate_device(); - if (!aiptek || !inputdev) + if (!aiptek || !inputdev) { + warn("aiptek: cannot allocate memory or input device"); goto fail1; + } aiptek->data = usb_buffer_alloc(usbdev, AIPTEK_PACKET_LENGTH, GFP_ATOMIC, &aiptek->data_dma); - if (!aiptek->data) + if (!aiptek->data) { + warn("aiptek: cannot allocate usb buffer"); goto fail1; + } aiptek->urb = usb_alloc_urb(0, GFP_KERNEL); - if (!aiptek->urb) + if (!aiptek->urb) { + warn("aiptek: cannot allocate urb"); goto fail2; + } aiptek->inputdev = inputdev; aiptek->usbdev = usbdev; @@ -1807,6 +1813,13 @@ aiptek_probe(struct usb_interface *intf, const struct usb_device_id *id) } } + /* Murphy says that some day someone will have a tablet that fails the + above test. That's you, Frederic Rodrigo */ + if (i == ARRAY_SIZE(speeds)) { + info("input: Aiptek tried all speeds, no sane response"); + goto fail2; + } + /* Associate this driver's struct with the usb interface. */ usb_set_intfdata(intf, aiptek); @@ -1814,15 +1827,18 @@ aiptek_probe(struct usb_interface *intf, const struct usb_device_id *id) /* Set up the sysfs files */ err = sysfs_create_group(&intf->dev.kobj, &aiptek_attribute_group); - if (err) + if (err) { + warn("aiptek: cannot create sysfs group err: %d", err); goto fail3; + } /* Register the tablet as an Input Device */ err = input_register_device(aiptek->inputdev); - if (err) + if (err) { + warn("aiptek: input_register_device returned err: %d", err); goto fail4; - + } return 0; fail4: sysfs_remove_group(&intf->dev.kobj, &aiptek_attribute_group);