There are several em28xx_write_reg() and em28xx_write_reg_bits()
calls that we have caught their return values but lack further
handling. Check and return error on failure just like other calls
in em28xx_capture_start().

Signed-off-by: Dinghao Liu <dinghao....@zju.edu.cn>
---
 drivers/media/usb/em28xx/em28xx-core.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/media/usb/em28xx/em28xx-core.c 
b/drivers/media/usb/em28xx/em28xx-core.c
index 584fa400cd7d..2563275fec8e 100644
--- a/drivers/media/usb/em28xx/em28xx-core.c
+++ b/drivers/media/usb/em28xx/em28xx-core.c
@@ -661,6 +661,8 @@ int em28xx_capture_start(struct em28xx *dev, int start)
                                                   EM2874_R5F_TS_ENABLE,
                                                   start ? 
EM2874_TS2_CAPTURE_ENABLE : 0x00,
                                                   EM2874_TS2_CAPTURE_ENABLE | 
EM2874_TS2_FILTER_ENABLE | EM2874_TS2_NULL_DISCARD);
+               if (rc < 0)
+                       return rc;
        } else {
                /* FIXME: which is the best order? */
                /* video registers are sampled by VREF */
@@ -670,8 +672,11 @@ int em28xx_capture_start(struct em28xx *dev, int start)
                        return rc;
 
                if (start) {
-                       if (dev->is_webcam)
+                       if (dev->is_webcam) {
                                rc = em28xx_write_reg(dev, 0x13, 0x0c);
+                               if (rc < 0)
+                                       return rc;
+                       }
 
                        /* Enable video capture */
                        rc = em28xx_write_reg(dev, 0x48, 0x00);
@@ -693,6 +698,8 @@ int em28xx_capture_start(struct em28xx *dev, int start)
                } else {
                        /* disable video capture */
                        rc = em28xx_write_reg(dev, EM28XX_R12_VINENABLE, 0x27);
+                       if (rc < 0)
+                               return rc;
                }
        }
 
-- 
2.17.1

Reply via email to