usb: gadget: dummy: fix infinite loop because of missing loop decrement
authorColin Ian King <colin.king@canonical.com>
Tue, 15 Aug 2017 07:38:45 +0000 (08:38 +0100)
committerFelipe Balbi <felipe.balbi@linux.intel.com>
Tue, 15 Aug 2017 09:46:04 +0000 (12:46 +0300)
The while loop never terminates because the loop counter i is never
decremented. Fix this by decrementing i.

Detected by CoverityScan, CID#751073 ("Infinite Loop")

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
drivers/usb/gadget/udc/dummy_hcd.c

index 3c3760315910803c44202720de450dc9072a3458..a030d7923d7db4b4776f04eea94ca484c4e623d0 100644 (file)
@@ -2776,7 +2776,7 @@ static int __init init(void)
                if (retval < 0) {
                        i--;
                        while (i >= 0)
-                               platform_device_del(the_udc_pdev[i]);
+                               platform_device_del(the_udc_pdev[i--]);
                        goto err_add_udc;
                }
        }