[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[cdi-devel] [PATCH 03/10] usb: Ignore hub power switching errors



! Aborting hub initialization because it tells us that the request to
  switch on power failed is a bad idea; maybe the hub simply does not
  support power switching after all. In any case, if switching on the
  power actually failed, nothing bad will happen if we go on (we simply
  will not see any devices).

Signed-off-by: Max Reitz <max@xxxxxxxxxx>
---
 usb/usb.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/usb/usb.c b/usb/usb.c
index 3141176..1f69c1b 100644
--- a/usb/usb.c
+++ b/usb/usb.c
@@ -816,17 +816,17 @@ static void new_hub_device(usb_logical_device_t *ldev)
     // Enable port power
     if (!(hub_desc->w_hub_characteristics & (1 << 1))) {
         // Hub supports power switching, enable global power
-        if (hub_set_hub_feature(hub, C_HUB_LOCAL_POWER) != CDI_USB_OK) {
-            goto fail;
-        }
+        hub_set_hub_feature(hub, C_HUB_LOCAL_POWER);
+        // Ignore the return value, maybe the port just does not support power
+        // switching after all; in any case, we do not gain anything by aborting
+        // here instead of just trying to go on anyway.
     }
 
     if ((hub_desc->w_hub_characteristics & 0x3) == 1) {
         // Hub supports per-port power switching, enable power for each port
         for (int port = 0; port < ports; port++) {
-            if (hub_set_port_feature(hub, PORT_POWER, port) != CDI_USB_OK) {
-                goto fail;
-            }
+            hub_set_port_feature(hub, PORT_POWER, port);
+            // Ignore the return value, for the same reason as above
         }
     }
 
-- 
2.6.4