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