diff options
author | Pete Zaitcev <zaitcev@redhat.com> | 2009-04-29 18:02:18 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2009-06-16 00:44:44 -0400 |
commit | e05b8e6e1066e7583dbb6b00407508797b737995 (patch) | |
tree | 7e0a3445a7f7f3035202dfa666d30f759e28a932 | |
parent | bf92c1906e4f294a48fafc15755c65af636195e0 (diff) |
USB: janitor storage initializers
We all know that pointless janitoring is bad, but this code is just
offensive. So:
- The error code goes directly to probe return, so don't return -1.
- Don't return return internal usb-storage codes either.
- usb_stor_control_msg takes timeout in milliseconds.
- Sanitize messages.
Signed-off-by: Pete Zaitcev <zaitcev@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r-- | drivers/usb/storage/initializers.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/drivers/usb/storage/initializers.c b/drivers/usb/storage/initializers.c index 2dd9bd4bff56..ec17c96371af 100644 --- a/drivers/usb/storage/initializers.c +++ b/drivers/usb/storage/initializers.c | |||
@@ -52,7 +52,7 @@ int usb_stor_euscsi_init(struct us_data *us) | |||
52 | us->iobuf[0] = 0x1; | 52 | us->iobuf[0] = 0x1; |
53 | result = usb_stor_control_msg(us, us->send_ctrl_pipe, | 53 | result = usb_stor_control_msg(us, us->send_ctrl_pipe, |
54 | 0x0C, USB_RECIP_INTERFACE | USB_TYPE_VENDOR, | 54 | 0x0C, USB_RECIP_INTERFACE | USB_TYPE_VENDOR, |
55 | 0x01, 0x0, us->iobuf, 0x1, 5*HZ); | 55 | 0x01, 0x0, us->iobuf, 0x1, 5000); |
56 | US_DEBUGP("-- result is %d\n", result); | 56 | US_DEBUGP("-- result is %d\n", result); |
57 | 57 | ||
58 | return 0; | 58 | return 0; |
@@ -80,14 +80,16 @@ int usb_stor_ucr61s2b_init(struct us_data *us) | |||
80 | 80 | ||
81 | res = usb_stor_bulk_transfer_buf(us, us->send_bulk_pipe, bcb, | 81 | res = usb_stor_bulk_transfer_buf(us, us->send_bulk_pipe, bcb, |
82 | US_BULK_CB_WRAP_LEN, &partial); | 82 | US_BULK_CB_WRAP_LEN, &partial); |
83 | if(res) | 83 | if (res) |
84 | return res; | 84 | return -EIO; |
85 | 85 | ||
86 | US_DEBUGP("Getting status packet...\n"); | 86 | US_DEBUGP("Getting status packet...\n"); |
87 | res = usb_stor_bulk_transfer_buf(us, us->recv_bulk_pipe, bcs, | 87 | res = usb_stor_bulk_transfer_buf(us, us->recv_bulk_pipe, bcs, |
88 | US_BULK_CS_WRAP_LEN, &partial); | 88 | US_BULK_CS_WRAP_LEN, &partial); |
89 | if (res) | ||
90 | return -EIO; | ||
89 | 91 | ||
90 | return (res ? -1 : 0); | 92 | return 0; |
91 | } | 93 | } |
92 | 94 | ||
93 | /* This places the HUAWEI E220 devices in multi-port mode */ | 95 | /* This places the HUAWEI E220 devices in multi-port mode */ |
@@ -99,6 +101,6 @@ int usb_stor_huawei_e220_init(struct us_data *us) | |||
99 | USB_REQ_SET_FEATURE, | 101 | USB_REQ_SET_FEATURE, |
100 | USB_TYPE_STANDARD | USB_RECIP_DEVICE, | 102 | USB_TYPE_STANDARD | USB_RECIP_DEVICE, |
101 | 0x01, 0x0, NULL, 0x0, 1000); | 103 | 0x01, 0x0, NULL, 0x0, 1000); |
102 | US_DEBUGP("usb_control_msg performing result is %d\n", result); | 104 | US_DEBUGP("Huawei mode set result is %d\n", result); |
103 | return (result ? 0 : -1); | 105 | return (result ? 0 : -ENODEV); |
104 | } | 106 | } |