aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/usb/serial/visor.c26
1 files changed, 18 insertions, 8 deletions
diff --git a/drivers/usb/serial/visor.c b/drivers/usb/serial/visor.c
index ad1f9232292d..178e4d9abb27 100644
--- a/drivers/usb/serial/visor.c
+++ b/drivers/usb/serial/visor.c
@@ -807,10 +807,14 @@ static int clie_3_5_startup(struct usb_serial *serial)
807{ 807{
808 struct device *dev = &serial->dev->dev; 808 struct device *dev = &serial->dev->dev;
809 int result; 809 int result;
810 u8 data; 810 u8 *data;
811 811
812 dbg("%s", __func__); 812 dbg("%s", __func__);
813 813
814 data = kmalloc(1, GFP_KERNEL);
815 if (!data)
816 return -ENOMEM;
817
814 /* 818 /*
815 * Note that PEG-300 series devices expect the following two calls. 819 * Note that PEG-300 series devices expect the following two calls.
816 */ 820 */
@@ -818,36 +822,42 @@ static int clie_3_5_startup(struct usb_serial *serial)
818 /* get the config number */ 822 /* get the config number */
819 result = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0), 823 result = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0),
820 USB_REQ_GET_CONFIGURATION, USB_DIR_IN, 824 USB_REQ_GET_CONFIGURATION, USB_DIR_IN,
821 0, 0, &data, 1, 3000); 825 0, 0, data, 1, 3000);
822 if (result < 0) { 826 if (result < 0) {
823 dev_err(dev, "%s: get config number failed: %d\n", 827 dev_err(dev, "%s: get config number failed: %d\n",
824 __func__, result); 828 __func__, result);
825 return result; 829 goto out;
826 } 830 }
827 if (result != 1) { 831 if (result != 1) {
828 dev_err(dev, "%s: get config number bad return length: %d\n", 832 dev_err(dev, "%s: get config number bad return length: %d\n",
829 __func__, result); 833 __func__, result);
830 return -EIO; 834 result = -EIO;
835 goto out;
831 } 836 }
832 837
833 /* get the interface number */ 838 /* get the interface number */
834 result = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0), 839 result = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0),
835 USB_REQ_GET_INTERFACE, 840 USB_REQ_GET_INTERFACE,
836 USB_DIR_IN | USB_RECIP_INTERFACE, 841 USB_DIR_IN | USB_RECIP_INTERFACE,
837 0, 0, &data, 1, 3000); 842 0, 0, data, 1, 3000);
838 if (result < 0) { 843 if (result < 0) {
839 dev_err(dev, "%s: get interface number failed: %d\n", 844 dev_err(dev, "%s: get interface number failed: %d\n",
840 __func__, result); 845 __func__, result);
841 return result; 846 goto out;
842 } 847 }
843 if (result != 1) { 848 if (result != 1) {
844 dev_err(dev, 849 dev_err(dev,
845 "%s: get interface number bad return length: %d\n", 850 "%s: get interface number bad return length: %d\n",
846 __func__, result); 851 __func__, result);
847 return -EIO; 852 result = -EIO;
853 goto out;
848 } 854 }
849 855
850 return generic_startup(serial); 856 result = generic_startup(serial);
857out:
858 kfree(data);
859
860 return result;
851} 861}
852 862
853static int treo_attach(struct usb_serial *serial) 863static int treo_attach(struct usb_serial *serial)