[media] media: i2c: lm3560: fix missing unlock on error in lm3560_set_ctrl()
authorWei Yongjun <yongjun_wei@trendmicro.com.cn>
Thu, 7 Nov 2013 12:44:42 +0000 (09:44 -0300)
committerMauro Carvalho Chehab <m.chehab@samsung.com>
Tue, 10 Dec 2013 13:07:30 +0000 (11:07 -0200)
Add the missing unlock before return from function lm3560_set_ctrl()
in the error handling case.

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
drivers/media/i2c/lm3560.c

index ab5857d66f2d8f58e5a708bdfc01f28746c0e069..e728d9fb08d1936a3c1e798bdb1edf0d9057d100 100644 (file)
@@ -219,15 +219,19 @@ static int lm3560_set_ctrl(struct v4l2_ctrl *ctrl, enum lm3560_led_id led_no)
                break;
 
        case V4L2_CID_FLASH_STROBE:
-               if (flash->led_mode != V4L2_FLASH_LED_MODE_FLASH)
-                       return -EBUSY;
+               if (flash->led_mode != V4L2_FLASH_LED_MODE_FLASH) {
+                       rval = -EBUSY;
+                       goto err_out;
+               }
                flash->led_mode = V4L2_FLASH_LED_MODE_FLASH;
                rval = lm3560_mode_ctrl(flash);
                break;
 
        case V4L2_CID_FLASH_STROBE_STOP:
-               if (flash->led_mode != V4L2_FLASH_LED_MODE_FLASH)
-                       return -EBUSY;
+               if (flash->led_mode != V4L2_FLASH_LED_MODE_FLASH) {
+                       rval = -EBUSY;
+                       goto err_out;
+               }
                flash->led_mode = V4L2_FLASH_LED_MODE_NONE;
                rval = lm3560_mode_ctrl(flash);
                break;
@@ -247,8 +251,8 @@ static int lm3560_set_ctrl(struct v4l2_ctrl *ctrl, enum lm3560_led_id led_no)
                break;
        }
 
-       mutex_unlock(&flash->lock);
 err_out:
+       mutex_unlock(&flash->lock);
        return rval;
 }