]> git.karo-electronics.de Git - mv-sheeva.git/blobdiff - drivers/usb/misc/cypress_cy7c63.c
Merge branch 'upstream' into upstream-jgarzik
[mv-sheeva.git] / drivers / usb / misc / cypress_cy7c63.c
index e091d327bd9e7839eccee2a9b11d036959feb30e..b63b5f34b2aa5f0f79b7103c9e14ce9e89f2b2a7 100644 (file)
 *      the single I/O ports of the device.
 *
 *      Supported vendors:      AK Modul-Bus Computer GmbH
-*      Supported devices:      CY7C63001A-PC (to be continued...)
-*      Supported functions:    Read/Write Ports (to be continued...)
+*                              (Firmware "Port-Chip")
+*
+*      Supported devices:      CY7C63001A-PC
+*                              CY7C63001C-PXC
+*                              CY7C63001C-SXC
+*
+*      Supported functions:    Read/Write Ports
 *
 *
 *      This program is free software; you can redistribute it and/or
@@ -203,8 +208,8 @@ static int cypress_probe(struct usb_interface *interface,
        /* allocate memory for our device state and initialize it */
        dev = kzalloc(sizeof(*dev), GFP_KERNEL);
        if (dev == NULL) {
-               dev_err(&dev->udev->dev, "Out of memory!\n");
-               goto error;
+               dev_err(&interface->dev, "Out of memory!\n");
+               goto error_mem;
        }
 
        dev->udev = usb_get_dev(interface_to_usbdev(interface));
@@ -213,15 +218,26 @@ static int cypress_probe(struct usb_interface *interface,
        usb_set_intfdata(interface, dev);
 
        /* create device attribute files */
-       device_create_file(&interface->dev, &dev_attr_port0);
-       device_create_file(&interface->dev, &dev_attr_port1);
+       retval = device_create_file(&interface->dev, &dev_attr_port0);
+       if (retval)
+               goto error;
+       retval = device_create_file(&interface->dev, &dev_attr_port1);
+       if (retval)
+               goto error;
 
        /* let the user know that the device is now attached */
        dev_info(&interface->dev,
                 "Cypress CY7C63xxx device now attached\n");
+       return 0;
 
-       retval = 0;
 error:
+       device_remove_file(&interface->dev, &dev_attr_port0);
+       device_remove_file(&interface->dev, &dev_attr_port1);
+       usb_set_intfdata(interface, NULL);
+       usb_put_dev(dev->udev);
+       kfree(dev);
+
+error_mem:
        return retval;
 }