]> git.karo-electronics.de Git - linux-beck.git/commitdiff
[media] zc3xx: remove dead code and uneeded gotos
authorMauro Carvalho Chehab <mchehab@osg.samsung.com>
Tue, 28 Apr 2015 22:49:07 +0000 (19:49 -0300)
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>
Thu, 30 Apr 2015 17:27:53 +0000 (14:27 -0300)
As reported by smatch:
drivers/media/usb/gspca/zc3xx.c:5994 transfer_update() info: ignoring unreachable code.

That happens because there's a return that it is never called,
as the work queue runs an infinite loop, except when the device is
put to sleep or an error happens.

When an error happens, a break statement is enough to go out of
the loop. So, let's remove the goto, as break is the typical
instruction used to end a loop.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
drivers/media/usb/gspca/zc3xx.c

index 3762a045f7449e58eb8cbe880729c0c4f31c9db6..c5d8ee6fa3c7187d0afec9a4d3930fa72012a12b 100644 (file)
@@ -5942,23 +5942,23 @@ static void transfer_update(struct work_struct *work)
        reg07 = 0;
 
        good = 0;
-       for (;;) {
+       while (1) {
                msleep(100);
 
                /* To protect gspca_dev->usb_buf and gspca_dev->usb_err */
                mutex_lock(&gspca_dev->usb_lock);
 #ifdef CONFIG_PM
                if (gspca_dev->frozen)
-                       goto err;
+                       break;
 #endif
                if (!gspca_dev->present || !gspca_dev->streaming)
-                       goto err;
+                       break;
 
                /* Bit 0 of register 11 indicates FIFO overflow */
                gspca_dev->usb_err = 0;
                reg11 = reg_r(gspca_dev, 0x0011);
                if (gspca_dev->usb_err)
-                       goto err;
+                       break;
 
                change = reg11 & 0x01;
                if (change) {                           /* overflow */
@@ -5987,12 +5987,12 @@ static void transfer_update(struct work_struct *work)
                        gspca_dev->usb_err = 0;
                        reg_w(gspca_dev, reg07, 0x0007);
                        if (gspca_dev->usb_err)
-                               goto err;
+                               break;
                }
                mutex_unlock(&gspca_dev->usb_lock);
        }
-       return;
-err:
+
+       /* Something went wrong. Unlock and return */
        mutex_unlock(&gspca_dev->usb_lock);
 }