[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[cdi-devel] [PATCH 09/10] usb-storage: Drop bulk_only_reset()'s return value
! Not all USB drives support a bulk-only reset, and if one does not,
this is definitely not a fatal error which would justify aborting
device initialization.
Signed-off-by: Max Reitz <max@xxxxxxxxxx>
---
usb-storage/usb-storage.c | 18 ++++++------------
1 file changed, 6 insertions(+), 12 deletions(-)
diff --git a/usb-storage/usb-storage.c b/usb-storage/usb-storage.c
index 544c779..7efe5c3 100644
--- a/usb-storage/usb-storage.c
+++ b/usb-storage/usb-storage.c
@@ -75,22 +75,21 @@ typedef struct usb_mass_storage_device {
} usb_mass_storage_device_t;
-static int bulk_only_reset(usb_mass_storage_device_t *dev)
+static void bulk_only_reset(usb_mass_storage_device_t *dev)
{
cdi_usb_transmission_result_t res;
- res = cdi_usb_control_transfer(&dev->usb, 0, &(struct cdi_usb_setup_packet){
+ // Do not check for success; this function does not need to be supported,
+ // and if it is not, there is not a whole lot we can do about it.
+ cdi_usb_control_transfer(&dev->usb, 0, &(struct cdi_usb_setup_packet){
.bm_request_type = CDI_USB_CREQ_CLASS | CDI_USB_CREQ_INTERFACE
| CDI_USB_CREQ_OUT,
.b_request = USBMS_REQ_BOMSR,
.w_index = dev->usb.interface
}, NULL);
- if (res != CDI_USB_OK) {
- return -EIO;
- }
if (dev->luns > 0) {
- return 0;
+ return;
}
uint8_t lun_count;
@@ -106,8 +105,6 @@ static int bulk_only_reset(usb_mass_storage_device_t *dev)
} else {
dev->luns = 1;
}
-
- return 0;
}
@@ -128,10 +125,7 @@ struct cdi_device *init_usb_device(struct cdi_bus_data *bus_data)
}
if (dev->type == USBMS_BULK_ONLY) {
- if (bulk_only_reset(dev) < 0) {
- free(dev);
- return NULL;
- }
+ bulk_only_reset(dev);
struct cdi_usb_endpoint_descriptor ep_desc;
for (int ep = 1; ep < dev->usb.endpoint_count; ep++) {
--
2.6.4