aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/input/acecad.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/input/acecad.c')
-rw-r--r--drivers/usb/input/acecad.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/drivers/usb/input/acecad.c b/drivers/usb/input/acecad.c
index 909138e5aa04..270bb050879a 100644
--- a/drivers/usb/input/acecad.c
+++ b/drivers/usb/input/acecad.c
@@ -135,6 +135,7 @@ static int usb_acecad_probe(struct usb_interface *intf, const struct usb_device_
135 struct usb_acecad *acecad; 135 struct usb_acecad *acecad;
136 struct input_dev *input_dev; 136 struct input_dev *input_dev;
137 int pipe, maxp; 137 int pipe, maxp;
138 int err = -ENOMEM;
138 139
139 if (interface->desc.bNumEndpoints != 1) 140 if (interface->desc.bNumEndpoints != 1)
140 return -ENODEV; 141 return -ENODEV;
@@ -149,16 +150,22 @@ static int usb_acecad_probe(struct usb_interface *intf, const struct usb_device_
149 150
150 acecad = kzalloc(sizeof(struct usb_acecad), GFP_KERNEL); 151 acecad = kzalloc(sizeof(struct usb_acecad), GFP_KERNEL);
151 input_dev = input_allocate_device(); 152 input_dev = input_allocate_device();
152 if (!acecad || !input_dev) 153 if (!acecad || !input_dev) {
154 err = -ENOMEM;
153 goto fail1; 155 goto fail1;
156 }
154 157
155 acecad->data = usb_buffer_alloc(dev, 8, GFP_KERNEL, &acecad->data_dma); 158 acecad->data = usb_buffer_alloc(dev, 8, GFP_KERNEL, &acecad->data_dma);
156 if (!acecad->data) 159 if (!acecad->data) {
160 err= -ENOMEM;
157 goto fail1; 161 goto fail1;
162 }
158 163
159 acecad->irq = usb_alloc_urb(0, GFP_KERNEL); 164 acecad->irq = usb_alloc_urb(0, GFP_KERNEL);
160 if (!acecad->irq) 165 if (!acecad->irq) {
166 err = -ENOMEM;
161 goto fail2; 167 goto fail2;
168 }
162 169
163 acecad->usbdev = dev; 170 acecad->usbdev = dev;
164 acecad->input = input_dev; 171 acecad->input = input_dev;
@@ -221,7 +228,9 @@ static int usb_acecad_probe(struct usb_interface *intf, const struct usb_device_
221 acecad->irq->transfer_dma = acecad->data_dma; 228 acecad->irq->transfer_dma = acecad->data_dma;
222 acecad->irq->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; 229 acecad->irq->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
223 230
224 input_register_device(acecad->input); 231 err = input_register_device(acecad->input);
232 if (err)
233 goto fail2;
225 234
226 usb_set_intfdata(intf, acecad); 235 usb_set_intfdata(intf, acecad);
227 236
@@ -230,7 +239,7 @@ static int usb_acecad_probe(struct usb_interface *intf, const struct usb_device_
230 fail2: usb_buffer_free(dev, 8, acecad->data, acecad->data_dma); 239 fail2: usb_buffer_free(dev, 8, acecad->data, acecad->data_dma);
231 fail1: input_free_device(input_dev); 240 fail1: input_free_device(input_dev);
232 kfree(acecad); 241 kfree(acecad);
233 return -ENOMEM; 242 return err;
234} 243}
235 244
236static void usb_acecad_disconnect(struct usb_interface *intf) 245static void usb_acecad_disconnect(struct usb_interface *intf)