aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/misc/cytherm.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/misc/cytherm.c')
-rw-r--r--drivers/usb/misc/cytherm.c35
1 files changed, 26 insertions, 9 deletions
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