From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 110E8C433EF for ; Sat, 16 Jul 2022 17:44:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231563AbiGPRoh (ORCPT ); Sat, 16 Jul 2022 13:44:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48616 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229501AbiGPRog (ORCPT ); Sat, 16 Jul 2022 13:44:36 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 21A531D31D; Sat, 16 Jul 2022 10:44:36 -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 ams.source.kernel.org (Postfix) with ESMTPS id 89F9CB80B06; Sat, 16 Jul 2022 17:44:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B68F8C34114; Sat, 16 Jul 2022 17:44:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1657993473; bh=hbTBbW6QwYIosLKzqWUQvgF2opXvpQpGWz92NfHdu/g=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=ftvWLqkC1SsT+mR7qoZ+TTUNRME6Izlsd4lTzWN2vl3Vze+diH7gtzKby47xsGDx7 QIanX/EDgzCmwpKMM7qn5+j1Aiw03xOHLucZ1y/tw7wsy3+sDnQboA/ssgAhkK2TTB yRYEN+0mlqjkhaFV610/QLyzVmy1fWYwg/jlkguV8UVnr9Hr1ljC2BkjlwPSXMGjGL YkzguM3p5BCIGTJa+ZitFSHqOre8gcZSjQOMIojzXVKBQlMIWfc01npXivnnDRz5qo y2lxLTaTUvr2ytq0rdIQ3A4xSGqPoKcRRbQtQRd05gJqnS2MIF0v4LStkqWT+T8mT2 xToVhzkHRd18g== Date: Sat, 16 Jul 2022 18:54:27 +0100 From: Jonathan Cameron To: Dan Carpenter Cc: Miquel Raynal , Lars-Peter Clausen , Nuno =?UTF-8?B?U8Oh?= , linux-iio@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: Re: [PATCH] iio: adc: max1027: unlock on error path in max1027_read_single_value() Message-ID: <20220716185427.21f2d660@jic23-huawei> In-Reply-To: References: X-Mailer: Claws Mail 4.1.0 (GTK 3.24.34; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org On Thu, 7 Jul 2022 17:54:45 +0300 Dan Carpenter wrote: > 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 Queued up on a special fixes-togreg-post-5.20-rc1 branch in iio.git as I don't think I'll get another pull request out for this in time to intercept the merge window. Thanks, Jonathan > --- > 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)