rlink: eliminate spurious indentation
authorZachary T Welch <zw@superlucidity.net>
Thu, 19 Nov 2009 20:12:21 +0000 (12:12 -0800)
committerZachary T Welch <zw@superlucidity.net>
Tue, 24 Nov 2009 15:30:19 +0000 (07:30 -0800)
Rework rlink_init to use less indentation.  Best viewed with diff -w.

src/jtag/rlink/rlink.c

index c88067c95b80fe563a992626ca816bb0343fd724..2cdc70a166d0969f8489daa94140d3a24c7ff06c 100644 (file)
@@ -1635,66 +1635,65 @@ int rlink_init(void)
 
                for (dev = bus->devices; dev; dev = dev->next)
                {
-                       if ((dev->descriptor.idVendor == USB_IDVENDOR) && (dev->descriptor.idProduct == USB_IDPRODUCT))
+                       if ((dev->descriptor.idVendor != USB_IDVENDOR) ||
+                               (dev->descriptor.idProduct != USB_IDPRODUCT))
                        {
-                               found = 1;
-                               LOG_DEBUG("Found device on bus.\n");
+                               continue;
+                       }
+                       found = 1;
+                       LOG_DEBUG("Found device on bus.\n");
 
-                               do
-                               {
-                                       if (dev->descriptor.bNumConfigurations > 1)
-                                       {
-                                               LOG_ERROR("Whoops! NumConfigurations is not 1, don't know what to do...\n");
-                                               break;
-                                       }
-                                       if (dev->config->bNumInterfaces > 1)
-                                       {
-                                               LOG_ERROR("Whoops! NumInterfaces is not 1, don't know what to do...\n");
-                                               break;
-                                       }
+                       if (dev->descriptor.bNumConfigurations > 1)
+                       {
+                               LOG_ERROR("Whoops! NumConfigurations is not 1, don't know what to do...\n");
+                               break;
+                       }
+                       if (dev->config->bNumInterfaces > 1)
+                       {
+                               LOG_ERROR("Whoops! NumInterfaces is not 1, don't know what to do...\n");
+                               break;
+                       }
+
+                       pHDev = usb_open(dev);
+                       if (!pHDev)
+                       {
+                               LOG_ERROR ("Failed to open device.\n");
+                               break;
+                       }
+                       LOG_DEBUG("Opened device, pHDev = %p\n",pHDev);
+
+                       /* usb_set_configuration required under win32 */
+                       usb_set_configuration(pHDev, dev->config[0].bConfigurationValue);
 
-                                       pHDev = usb_open(dev);
-                                       if (!pHDev)
-                                               LOG_ERROR ("Failed to open device.\n");
-                                       else
-                                       {
-                                               LOG_DEBUG("Opened device, pHDev = %p\n",pHDev);
-
-                                               /* usb_set_configuration required under win32 */
-                                               usb_set_configuration(pHDev, dev->config[0].bConfigurationValue);
-
-                                               retries = 3;
-                                               do
-                                               {
-                                                       i = usb_claim_interface(pHDev,0);
-                                                       if (i)
-                                                       {
-                                                               LOG_ERROR("usb_claim_interface: %s", usb_strerror());
+                       retries = 3;
+                       do
+                       {
+                               i = usb_claim_interface(pHDev,0);
+                               if (i)
+                               {
+                                       LOG_ERROR("usb_claim_interface: %s", usb_strerror());
 #ifdef LIBUSB_HAS_DETACH_KERNEL_DRIVER_NP
-                                                               j = usb_detach_kernel_driver_np(pHDev, 0);
-                                                               if (j)
-                                                                       LOG_ERROR("detach kernel driver: %s", usb_strerror());
+                                       j = usb_detach_kernel_driver_np(pHDev, 0);
+                                       if (j)
+                                               LOG_ERROR("detach kernel driver: %s", usb_strerror());
 #endif
-                                                       }
-                                                       else
-                                                       {
-                                                               LOG_DEBUG("interface claimed!\n");
-                                                               break;
-                                                       }
-                                               } while (--retries);
-
-                                               if (!i)
-                                               {
-                                                       if (usb_set_altinterface(pHDev,0))
-                                                       {
-                                                               LOG_ERROR("Failed to set interface.\n");
-                                                               break;
-                                                       }
-                                                       else
-                                                               success = 1;
-                                               }
-                                       }
-                               } while (0);
+                               }
+                               else
+                               {
+                                       LOG_DEBUG("interface claimed!\n");
+                                       break;
+                               }
+                       } while (--retries);
+
+                       if (!i)
+                       {
+                               if (usb_set_altinterface(pHDev,0))
+                               {
+                                       LOG_ERROR("Failed to set interface.\n");
+                                       break;
+                               }
+                               else
+                                       success = 1;
                        }
                }
        }

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)