From patchwork Thu Nov 14 03:43:27 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Jeong X-Patchwork-Id: 3180871 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id EEA93C045B for ; Thu, 14 Nov 2013 03:44:19 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1E99720957 for ; Thu, 14 Nov 2013 03:44:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3BD9820956 for ; Thu, 14 Nov 2013 03:44:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752783Ab3KNDoO (ORCPT ); Wed, 13 Nov 2013 22:44:14 -0500 Received: from mail-pa0-f49.google.com ([209.85.220.49]:63146 "EHLO mail-pa0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751394Ab3KNDoN (ORCPT ); Wed, 13 Nov 2013 22:44:13 -0500 Received: by mail-pa0-f49.google.com with SMTP id lf10so1435665pab.8 for ; Wed, 13 Nov 2013 19:44:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=D7Oiecs+zxwSR9P3emzYhEn8VjPfCoSudo3PWfgCIHg=; b=rfQlc0PpEUeeM4dDcfEyk+6hZWgi/Dk05NfuzQ1bUezDTY6koIFeK8IZkhaHczzMwP R9TaF3ii0Tu8KlVnCuj6kh00x2VwLO0+cW74qm5+czfXlqc3NdSvy/6QLIKweBCIbv8U bAirQB3lo96fkxDOz9nzExAGQh2VrFrf8Sts5pdz/DEZfOuqWuESL2C99QK7GcUVXzyU XqaS6lvBEq4vnybBk6hZ6OP+yz8lW8K+uNmBejM4HubYKhAa7f47vn6sMLf4uE8FKf5e BUxWje7Yufcw2V4Xd+BsrrTnxM63IM2mFlaxSw+Gxq6df0NMRQII6ixnW0h+GngMpMQU Pu3Q== X-Received: by 10.68.190.103 with SMTP id gp7mr44905595pbc.74.1384400651377; Wed, 13 Nov 2013 19:44:11 -0800 (PST) Received: from localhost.localdomain ([39.7.52.201]) by mx.google.com with ESMTPSA id tu6sm47940292pbc.41.2013.11.13.19.44.00 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 13 Nov 2013 19:44:10 -0800 (PST) From: Daniel Jeong To: Mauro Carvalho Chehab Cc: Hans Verkuil , Daniel Jeong , , Sakari Ailus , Andy Shevchenko , , Dan Carpenter Subject: [PATCH -next] [media] media: i2c: lm3560: fix missing unlock error in lm3560_get_ctrl(). Date: Thu, 14 Nov 2013 12:43:27 +0900 Message-Id: <1384400607-18504-1-git-send-email-gshark.jeong@gmail.com> X-Mailer: git-send-email 1.7.9.5 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add the missing unlock before return from function lm3560_get_ctrl() to avoid deadlock. Thanks to Dan Carpenter. Signed-off-by: Daniel Jeong --- drivers/media/i2c/lm3560.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/media/i2c/lm3560.c b/drivers/media/i2c/lm3560.c index 3317a9a..5d6eef0 100644 --- a/drivers/media/i2c/lm3560.c +++ b/drivers/media/i2c/lm3560.c @@ -172,16 +172,16 @@ static int lm3560_flash_brt_ctrl(struct lm3560_flash *flash, static int lm3560_get_ctrl(struct v4l2_ctrl *ctrl, enum lm3560_led_id led_no) { struct lm3560_flash *flash = to_lm3560_flash(ctrl, led_no); + int rval = -EINVAL; mutex_lock(&flash->lock); if (ctrl->id == V4L2_CID_FLASH_FAULT) { - int rval; s32 fault = 0; unsigned int reg_val; rval = regmap_read(flash->regmap, REG_FLAG, ®_val); if (rval < 0) - return rval; + goto out; if (rval & FAULT_SHORT_CIRCUIT) fault |= V4L2_FLASH_FAULT_SHORT_CIRCUIT; if (rval & FAULT_OVERTEMP) @@ -189,11 +189,11 @@ static int lm3560_get_ctrl(struct v4l2_ctrl *ctrl, enum lm3560_led_id led_no) if (rval & FAULT_TIMEOUT) fault |= V4L2_FLASH_FAULT_TIMEOUT; ctrl->cur.val = fault; - return 0; } +out: mutex_unlock(&flash->lock); - return -EINVAL; + return rval; } static int lm3560_set_ctrl(struct v4l2_ctrl *ctrl, enum lm3560_led_id led_no)