Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3095234rwb; Mon, 15 Aug 2022 18:00:49 -0700 (PDT) X-Google-Smtp-Source: AA6agR7kl4fpvTbgnIKMlF6xG3vcJ3XsMXZ83t0iylfwtT+e72Vez/YWCMRohu6OzD45m3PDkl6r X-Received: by 2002:aa7:c9c2:0:b0:440:b458:9403 with SMTP id i2-20020aa7c9c2000000b00440b4589403mr16800505edt.132.1660611648897; Mon, 15 Aug 2022 18:00:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660611648; cv=none; d=google.com; s=arc-20160816; b=x3zBTQSWGQuM74P7oDHQidCtC3zRG/JG5ltwyWn712cTdzwiXgGud0jRRu4pAL1QGX HY4df1+iUd8Dt0oIv7uOwVJTHmq/6U4xBvE5EH7pi8cewIfK9AEsXc02AnfP3JbV23eW 4wAZ/kKVdRoOl+14Pi36s7ts32qX+djtf2d/7G8QqIZ0icEa7lOPwnd8f5vzBqNhLHOp z8U9CUf7v4U0LxQYE4ZxE45GPV1tLfZGJGfRttFUU/07mOEjreRGvuJoDdT2GCWeO2B3 gGV1x4DKkRjpNY4tiYKAy2RCddeLgE4AtGy72ZYtyrGfT1EGADSqBP0JwN2vU/qwkgtN BuRw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=QHBhcXXnjhqpta/dpNKGNnvEoopKNAbxf9jspOS4sBs=; b=OhMXh02Ke0lldKPATa0Vz/dalEfR1LQKfKV8oUwcYW1E+ebHhuWtKXOnfn22rUKvNB /wyvkt+wRMeX9wYGfgecKdFqEgKe9dWPik1zwLNV/FFYePlpHnVv3JFCH097iVGTn+Dm kOXeu2QrG0Qx6cqGXZnI9YvBRSIkQGhJXPPpsy5TysX8Zz1zXLRuBPpbL5iJ6/fTGwK4 G8HlENQcdLv1aiKsY6O8w0Zwpsp+kWJiqg91ggVrbN/xJ+dxhAjDKABCXLzI76eM0DLZ faZ1HnTSRyKzWLNUBylPouNLsPOVg4CLrJDFMOinwJIzVWaN2S0nK9pYvxQvabaUShhs 3Aug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=UeYd+pxg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a10-20020a1709065f8a00b007307d091ec9si8006056eju.428.2022.08.15.18.00.23; Mon, 15 Aug 2022 18:00:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=UeYd+pxg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350144AbiHPAdZ (ORCPT + 99 others); Mon, 15 Aug 2022 20:33:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35866 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352794AbiHPAbC (ORCPT ); Mon, 15 Aug 2022 20:31:02 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5864B1859BA; Mon, 15 Aug 2022 13:36:08 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B90D9611D2; Mon, 15 Aug 2022 20:36:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AA1BBC433D6; Mon, 15 Aug 2022 20:36:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660595766; bh=09RnNxg19SQJ4cNTRE294GN7J1KK248eGE8198Ys4xk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UeYd+pxgN3vcsTpqLbTFYF7420chX1DstmTocfo4B+KvUxFx+30S20gCBTpF4+mEs XkEdxrTNu++BBt9a3UcKLBGn4gKBYIBt+KRmfVnWbQz5zRRKsT4+JyG972SQPK2zyY 2SoXOXo0aa6Ea8xL9mshNWsAEt+jVhsKhqyBZmEE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Jonathan Cameron , Sasha Levin Subject: [PATCH 5.19 0835/1157] iio: adc: max1027: unlock on error path in max1027_read_single_value() Date: Mon, 15 Aug 2022 20:03:11 +0200 Message-Id: <20220815180512.893249817@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180439.416659447@linuxfoundation.org> References: <20220815180439.416659447@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dan Carpenter [ Upstream commit 06ee60eb507f00fb3643876ec05318c63332dc88 ] If max1027_wait_eoc() fails then call iio_device_release_direct_mode() before returning. Fixes: a0e831653ef9 ("iio: adc: max1027: Introduce an end of conversion helper") Signed-off-by: Dan Carpenter Link: https://lore.kernel.org/r/YsbztVuAXnau2cIZ@kili Signed-off-by: Jonathan Cameron Signed-off-by: Sasha Levin --- drivers/iio/adc/max1027.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/iio/adc/max1027.c b/drivers/iio/adc/max1027.c index b725d012625c..136fcf753837 100644 --- a/drivers/iio/adc/max1027.c +++ b/drivers/iio/adc/max1027.c @@ -349,8 +349,7 @@ static int max1027_read_single_value(struct iio_dev *indio_dev, if (ret < 0) { dev_err(&indio_dev->dev, "Failed to configure conversion register\n"); - iio_device_release_direct_mode(indio_dev); - return ret; + goto release; } /* @@ -360,11 +359,12 @@ static int max1027_read_single_value(struct iio_dev *indio_dev, */ ret = max1027_wait_eoc(indio_dev); if (ret) - return ret; + goto release; /* Read result */ ret = spi_read(st->spi, st->buffer, (chan->type == IIO_TEMP) ? 4 : 2); +release: iio_device_release_direct_mode(indio_dev); if (ret < 0) -- 2.35.1