summaryrefslogtreecommitdiff
path: root/drivers/input/joystick/iforce/iforce-usb.c
diff options
context:
space:
mode:
authorDmitry Torokhov <dtor_core@ameritech.net>2005-09-15 02:01:52 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2005-10-28 09:52:53 -0700
commit17dd3f0f7aa729a042af5d3318ff9b3e7781b45b (patch)
tree261580f0229e6365f044cd26925dfb2735e0754d /drivers/input/joystick/iforce/iforce-usb.c
parent0259567ad60df13a55583b84d2cddb5526705907 (diff)
[PATCH] drivers/input/joystick: convert to dynamic input_dev allocation
Input: convert drivers/input/joystick to dynamic input_dev allocation This is required for input_dev sysfs integration Signed-off-by: Dmitry Torokhov <dtor@mail.ru> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/input/joystick/iforce/iforce-usb.c')
-rw-r--r--drivers/input/joystick/iforce/iforce-usb.c22
1 files changed, 10 insertions, 12 deletions
diff --git a/drivers/input/joystick/iforce/iforce-usb.c b/drivers/input/joystick/iforce/iforce-usb.c
index 58600f91eff5..64b4a3080985 100644
--- a/drivers/input/joystick/iforce/iforce-usb.c
+++ b/drivers/input/joystick/iforce/iforce-usb.c
@@ -135,28 +135,24 @@ static int iforce_usb_probe(struct usb_interface *intf,
struct usb_host_interface *interface;
struct usb_endpoint_descriptor *epirq, *epout;
struct iforce *iforce;
+ int err = -ENOMEM;
interface = intf->cur_altsetting;
epirq = &interface->endpoint[0].desc;
epout = &interface->endpoint[1].desc;
- if (!(iforce = kmalloc(sizeof(struct iforce) + 32, GFP_KERNEL)))
+ if (!(iforce = kzalloc(sizeof(struct iforce) + 32, GFP_KERNEL)))
goto fail;
- memset(iforce, 0, sizeof(struct iforce));
-
- if (!(iforce->irq = usb_alloc_urb(0, GFP_KERNEL))) {
+ if (!(iforce->irq = usb_alloc_urb(0, GFP_KERNEL)))
goto fail;
- }
- if (!(iforce->out = usb_alloc_urb(0, GFP_KERNEL))) {
+ if (!(iforce->out = usb_alloc_urb(0, GFP_KERNEL)))
goto fail;
- }
- if (!(iforce->ctrl = usb_alloc_urb(0, GFP_KERNEL))) {
+ if (!(iforce->ctrl = usb_alloc_urb(0, GFP_KERNEL)))
goto fail;
- }
iforce->bus = IFORCE_USB;
iforce->usbdev = dev;
@@ -174,7 +170,9 @@ static int iforce_usb_probe(struct usb_interface *intf,
usb_fill_control_urb(iforce->ctrl, dev, usb_rcvctrlpipe(dev, 0),
(void*) &iforce->cr, iforce->edata, 16, iforce_usb_ctrl, iforce);
- if (iforce_init_device(iforce)) goto fail;
+ err = iforce_init_device(iforce);
+ if (err)
+ goto fail;
usb_set_intfdata(intf, iforce);
return 0;
@@ -187,7 +185,7 @@ fail:
kfree(iforce);
}
- return -ENODEV;
+ return err;
}
/* Called by iforce_delete() */
@@ -211,7 +209,7 @@ static void iforce_usb_disconnect(struct usb_interface *intf)
usb_set_intfdata(intf, NULL);
if (iforce) {
iforce->usbdev = NULL;
- input_unregister_device(&iforce->dev);
+ input_unregister_device(iforce->dev);
if (!open) {
iforce_delete_device(iforce);