From patchwork Mon Mar 20 14:40:06 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alan Cox X-Patchwork-Id: 9634371 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 3BC3F601E9 for ; Mon, 20 Mar 2017 14:57:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 29B4B20223 for ; Mon, 20 Mar 2017 14:57:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1CB84205FB; Mon, 20 Mar 2017 14:57:15 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AD91C20223 for ; Mon, 20 Mar 2017 14:57:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754253AbdCTO40 (ORCPT ); Mon, 20 Mar 2017 10:56:26 -0400 Received: from mga03.intel.com ([134.134.136.65]:20890 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753427AbdCTOzt (ORCPT ); Mon, 20 Mar 2017 10:55:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=intel.com; i=@intel.com; q=dns/txt; s=intel; t=1490021749; x=1521557749; h=subject:from:to:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=WyHJ2wD3DRciPO3GmXTxGQpTwqNNsIdRj8ALYd4rZpo=; b=a06HR8Fpsp1ZrEKHiRCL4A9SeKP/U61ns8yqWoUumwIs9eCGvEMh0UUr inZsJ46z2rQEFNS2gnsedb/89OMiHQ==; Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Mar 2017 07:40:08 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.36,194,1486454400"; d="scan'208";a="238288796" Received: from acox1-desk1.ger.corp.intel.com ([10.252.22.109]) by fmsmga004.fm.intel.com with ESMTP; 20 Mar 2017 07:40:07 -0700 Subject: [PATCH 08/24] atomisp/imx: Fix locking bug on error path From: Alan Cox To: greg@kroah.com, linux-media@vger.kernel.org Date: Mon, 20 Mar 2017 14:40:06 +0000 Message-ID: <149002080343.17109.13144918778111462380.stgit@acox1-desk1.ger.corp.intel.com> In-Reply-To: <149002068431.17109.1216139691005241038.stgit@acox1-desk1.ger.corp.intel.com> References: <149002068431.17109.1216139691005241038.stgit@acox1-desk1.ger.corp.intel.com> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This was reported by Dan Carpenter. When we error with an IMX 227 we don't release the lock and the sensor would then hang. Signed-off-by: Alan Cox --- drivers/staging/media/atomisp/i2c/imx/imx.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/staging/media/atomisp/i2c/imx/imx.c b/drivers/staging/media/atomisp/i2c/imx/imx.c index a73f902..408a7b9 100644 --- a/drivers/staging/media/atomisp/i2c/imx/imx.c +++ b/drivers/staging/media/atomisp/i2c/imx/imx.c @@ -454,8 +454,10 @@ static int imx_set_exposure_gain(struct v4l2_subdev *sd, u16 coarse_itg, if (dev->sensor_id == IMX227_ID) { ret = imx_write_reg_array(client, imx_param_hold); - if (ret) + if (ret) { + mutex_unlock(&dev->input_lock); return ret; + } } /* For imx175, setting gain must be delayed by one */