From: Wei Yongjun Date: Thu, 7 Nov 2013 12:44:42 +0000 (-0300) Subject: [media] media: i2c: lm3560: fix missing unlock on error in lm3560_set_ctrl() X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=eed8c3eebce72fe4fc766f9a23e4324b04bd86cf;p=linux-beck.git [media] media: i2c: lm3560: fix missing unlock on error in lm3560_set_ctrl() Add the missing unlock before return from function lm3560_set_ctrl() in the error handling case. Signed-off-by: Wei Yongjun Signed-off-by: Mauro Carvalho Chehab --- diff --git a/drivers/media/i2c/lm3560.c b/drivers/media/i2c/lm3560.c index ab5857d66f2d..e728d9fb08d1 100644 --- a/drivers/media/i2c/lm3560.c +++ b/drivers/media/i2c/lm3560.c @@ -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; }