Message ID | 20131216094544.GB13831@elgon.mountain (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Hi Dan and Daniel, On Mon, Dec 16, 2013 at 12:45:44PM +0300, Dan Carpenter wrote: > There are several error paths which don't unlock on error. > > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Thanks for the patch. However it seems this change has been already done by essentially similar patch (w/o the redundant rval check removal): commit eed8c3eebce72fe4fc766f9a23e4324b04bd86cf Author: Wei Yongjun <yongjun_wei@trendmicro.com.cn> Date: Thu Nov 7 09:44:42 2013 -0300 [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 <yongjun_wei@trendmicro.com.cn> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com> This patch is in Mauro's tree already (and possibly elsewhere).
diff --git a/drivers/media/i2c/lm3560.c b/drivers/media/i2c/lm3560.c index ab5857d66f2d..fd96cfd6a9ec 100644 --- a/drivers/media/i2c/lm3560.c +++ b/drivers/media/i2c/lm3560.c @@ -214,20 +214,22 @@ static int lm3560_set_ctrl(struct v4l2_ctrl *ctrl, enum lm3560_led_id led_no) case V4L2_CID_FLASH_STROBE_SOURCE: rval = regmap_update_bits(flash->regmap, REG_CONFIG1, 0x04, (ctrl->val) << 2); - if (rval < 0) - goto err_out; 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_unlock; + } 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_unlock; + } flash->led_mode = V4L2_FLASH_LED_MODE_NONE; rval = lm3560_mode_ctrl(flash); break; @@ -247,8 +249,9 @@ static int lm3560_set_ctrl(struct v4l2_ctrl *ctrl, enum lm3560_led_id led_no) break; } +err_unlock: mutex_unlock(&flash->lock); -err_out: + return rval; }
There are several error paths which don't unlock on error. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html