aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/usb/misc/cypress_cy7c63.c19
-rw-r--r--drivers/usb/misc/cytherm.c35
-rw-r--r--drivers/usb/misc/usbled.c20
3 files changed, 57 insertions, 17 deletions
diff --git a/drivers/usb/misc/cypress_cy7c63.c b/drivers/usb/misc/cypress_cy7c63.c
index 9c46746d5d00..b63b5f34b2aa 100644
--- a/drivers/usb/misc/cypress_cy7c63.c
+++ b/drivers/usb/misc/cypress_cy7c63.c
@@ -209,7 +209,7 @@ static int cypress_probe(struct usb_interface *interface,
209 dev = kzalloc(sizeof(*dev), GFP_KERNEL); 209 dev = kzalloc(sizeof(*dev), GFP_KERNEL);
210 if (dev == NULL) { 210 if (dev == NULL) {
211 dev_err(&interface->dev, "Out of memory!\n"); 211 dev_err(&interface->dev, "Out of memory!\n");
212 goto error; 212 goto error_mem;
213 } 213 }
214 214
215 dev->udev = usb_get_dev(interface_to_usbdev(interface)); 215 dev->udev = usb_get_dev(interface_to_usbdev(interface));
@@ -218,15 +218,26 @@ static int cypress_probe(struct usb_interface *interface,
218 usb_set_intfdata(interface, dev); 218 usb_set_intfdata(interface, dev);
219 219
220 /* create device attribute files */ 220 /* create device attribute files */
221 device_create_file(&interface->dev, &dev_attr_port0); 221 retval = device_create_file(&interface->dev, &dev_attr_port0);
222 device_create_file(&interface->dev, &dev_attr_port1); 222 if (retval)
223 goto error;
224 retval = device_create_file(&interface->dev, &dev_attr_port1);
225 if (retval)
226 goto error;
223 227
224 /* let the user know that the device is now attached */ 228 /* let the user know that the device is now attached */
225 dev_info(&interface->dev, 229 dev_info(&interface->dev,
226 "Cypress CY7C63xxx device now attached\n"); 230 "Cypress CY7C63xxx device now attached\n");
231 return 0;
227 232
228 retval = 0;
229error: 233error:
234 device_remove_file(&interface->dev, &dev_attr_port0);
235 device_remove_file(&interface->dev, &dev_attr_port1);
236 usb_set_intfdata(interface, NULL);
237 usb_put_dev(dev->udev);
238 kfree(dev);
239
240error_mem:
230 return retval; 241 return retval;
231} 242}
232 243
diff --git a/drivers/usb/misc/cytherm.c b/drivers/usb/misc/cytherm.c
index b20bec445552..04e87acd6e46 100644
--- a/drivers/usb/misc/cytherm.c
+++ b/drivers/usb/misc/cytherm.c
@@ -353,7 +353,7 @@ static int cytherm_probe(struct usb_interface *interface,
353 dev = kzalloc (sizeof(struct usb_cytherm), GFP_KERNEL); 353 dev = kzalloc (sizeof(struct usb_cytherm), GFP_KERNEL);
354 if (dev == NULL) { 354 if (dev == NULL) {
355 dev_err (&interface->dev, "Out of memory\n"); 355 dev_err (&interface->dev, "Out of memory\n");
356 goto error; 356 goto error_mem;
357 } 357 }
358 358
359 dev->udev = usb_get_dev(udev); 359 dev->udev = usb_get_dev(udev);
@@ -362,18 +362,35 @@ static int cytherm_probe(struct usb_interface *interface,
362 362
363 dev->brightness = 0xFF; 363 dev->brightness = 0xFF;
364 364
365 device_create_file(&interface->dev, &dev_attr_brightness); 365 retval = device_create_file(&interface->dev, &dev_attr_brightness);
366 device_create_file(&interface->dev, &dev_attr_temp); 366 if (retval)
367 device_create_file(&interface->dev, &dev_attr_button); 367 goto error;
368 device_create_file(&interface->dev, &dev_attr_port0); 368 retval = device_create_file(&interface->dev, &dev_attr_temp);
369 device_create_file(&interface->dev, &dev_attr_port1); 369 if (retval)
370 goto error;
371 retval = device_create_file(&interface->dev, &dev_attr_button);
372 if (retval)
373 goto error;
374 retval = device_create_file(&interface->dev, &dev_attr_port0);
375 if (retval)
376 goto error;
377 retval = device_create_file(&interface->dev, &dev_attr_port1);
378 if (retval)
379 goto error;
370 380
371 dev_info (&interface->dev, 381 dev_info (&interface->dev,
372 "Cypress thermometer device now attached\n"); 382 "Cypress thermometer device now attached\n");
373 return 0; 383 return 0;
374 384error:
375 error: 385 device_remove_file(&interface->dev, &dev_attr_brightness);
386 device_remove_file(&interface->dev, &dev_attr_temp);
387 device_remove_file(&interface->dev, &dev_attr_button);
388 device_remove_file(&interface->dev, &dev_attr_port0);
389 device_remove_file(&interface->dev, &dev_attr_port1);
390 usb_set_intfdata (interface, NULL);
391 usb_put_dev(dev->udev);
376 kfree(dev); 392 kfree(dev);
393error_mem:
377 return retval; 394 return retval;
378} 395}
379 396
diff --git a/drivers/usb/misc/usbled.c b/drivers/usb/misc/usbled.c
index 0c5ee0ad6bb9..49c5c5c4c431 100644
--- a/drivers/usb/misc/usbled.c
+++ b/drivers/usb/misc/usbled.c
@@ -108,22 +108,34 @@ static int led_probe(struct usb_interface *interface, const struct usb_device_id
108 dev = kzalloc(sizeof(struct usb_led), GFP_KERNEL); 108 dev = kzalloc(sizeof(struct usb_led), GFP_KERNEL);
109 if (dev == NULL) { 109 if (dev == NULL) {
110 dev_err(&interface->dev, "Out of memory\n"); 110 dev_err(&interface->dev, "Out of memory\n");
111 goto error; 111 goto error_mem;
112 } 112 }
113 113
114 dev->udev = usb_get_dev(udev); 114 dev->udev = usb_get_dev(udev);
115 115
116 usb_set_intfdata (interface, dev); 116 usb_set_intfdata (interface, dev);
117 117
118 device_create_file(&interface->dev, &dev_attr_blue); 118 retval = device_create_file(&interface->dev, &dev_attr_blue);
119 device_create_file(&interface->dev, &dev_attr_red); 119 if (retval)
120 device_create_file(&interface->dev, &dev_attr_green); 120 goto error;
121 retval = device_create_file(&interface->dev, &dev_attr_red);
122 if (retval)
123 goto error;
124 retval = device_create_file(&interface->dev, &dev_attr_green);
125 if (retval)
126 goto error;
121 127
122 dev_info(&interface->dev, "USB LED device now attached\n"); 128 dev_info(&interface->dev, "USB LED device now attached\n");
123 return 0; 129 return 0;
124 130
125error: 131error:
132 device_remove_file(&interface->dev, &dev_attr_blue);
133 device_remove_file(&interface->dev, &dev_attr_red);
134 device_remove_file(&interface->dev, &dev_attr_green);
135 usb_set_intfdata (interface, NULL);
136 usb_put_dev(dev->udev);
126 kfree(dev); 137 kfree(dev);
138error_mem:
127 return retval; 139 return retval;
128} 140}
129 141