File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -807,47 +807,57 @@ static int clie_3_5_startup(struct usb_serial *serial)
807807{
808808 struct device * dev = & serial -> dev -> dev ;
809809 int result ;
810- u8 data ;
810+ u8 * data ;
811811
812812 dbg ("%s" , __func__ );
813813
814+ data = kmalloc (1 , GFP_KERNEL );
815+ if (!data )
816+ return - ENOMEM ;
817+
814818 /*
815819 * Note that PEG-300 series devices expect the following two calls.
816820 */
817821
818822 /* get the config number */
819823 result = usb_control_msg (serial -> dev , usb_rcvctrlpipe (serial -> dev , 0 ),
820824 USB_REQ_GET_CONFIGURATION , USB_DIR_IN ,
821- 0 , 0 , & data , 1 , 3000 );
825+ 0 , 0 , data , 1 , 3000 );
822826 if (result < 0 ) {
823827 dev_err (dev , "%s: get config number failed: %d\n" ,
824828 __func__ , result );
825- return result ;
829+ goto out ;
826830 }
827831 if (result != 1 ) {
828832 dev_err (dev , "%s: get config number bad return length: %d\n" ,
829833 __func__ , result );
830- return - EIO ;
834+ result = - EIO ;
835+ goto out ;
831836 }
832837
833838 /* get the interface number */
834839 result = usb_control_msg (serial -> dev , usb_rcvctrlpipe (serial -> dev , 0 ),
835840 USB_REQ_GET_INTERFACE ,
836841 USB_DIR_IN | USB_RECIP_INTERFACE ,
837- 0 , 0 , & data , 1 , 3000 );
842+ 0 , 0 , data , 1 , 3000 );
838843 if (result < 0 ) {
839844 dev_err (dev , "%s: get interface number failed: %d\n" ,
840845 __func__ , result );
841- return result ;
846+ goto out ;
842847 }
843848 if (result != 1 ) {
844849 dev_err (dev ,
845850 "%s: get interface number bad return length: %d\n" ,
846851 __func__ , result );
847- return - EIO ;
852+ result = - EIO ;
853+ goto out ;
848854 }
849855
850- return generic_startup (serial );
856+ result = generic_startup (serial );
857+ out :
858+ kfree (data );
859+
860+ return result ;
851861}
852862
853863static int treo_attach (struct usb_serial * serial )
You can’t perform that action at this time.
0 commit comments