From patchwork Sat Oct 22 07:24:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 7413 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1097513wrr; Sat, 22 Oct 2022 01:07:58 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6p0k6G3WwOa0RcSxRNR0hcXPPUp+Uko9KSd0KFvyBc8uZamW0KROI3OU+fAOMamq33dMwn X-Received: by 2002:a17:902:ed82:b0:178:5653:ecfb with SMTP id e2-20020a170902ed8200b001785653ecfbmr23356087plj.58.1666426078068; Sat, 22 Oct 2022 01:07:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666426078; cv=none; d=google.com; s=arc-20160816; b=Hbhwk5wgiH++C33xAdfv99ah4n3cin1de+Kbr9iHyp0V/Mtx6qKH9l8LpfbTQV5KxC AjUXCQOS4DRtlJS0pvG5OhVFYwmxrYHYSW4mzdAnRKUBzpgXj/cHrJszuxv9oEn9gdHV xLqIXSRqUmxhcN8GVSuaN9vPMXRcN3ByLaZ+v37kEVZIBPF8hR7Y3bum3vqfl/mcXSuz tDYwfb5fUyPotyHEQWJiHe9JY5R+cz76HF0vPZmejbwjQ0UDvPssCa++KVtXnInK71MA wkHkdWTLAITbDUoOlJBefJNcqaAW4qzEHgJTtmj9ffA1bX1WqaBYhZVci7i/bV1Hz1nu 03Zw== 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=oRt+whfwsnI/uN2WYCDt/r3jXpQV5fLuFL2/TucVDKw=; b=mH+Dq/YzjkqyZEer3jZrWEUQDAzVr9ZzA5k+Cyw8I/EsL7ykpYaux3LdBzZ0XXTwPI N8DiY0mNv7Ow9rkrUn6hga0SRU9+o/uLChvBpKOemBsZIAZmOZBm2KzWbdBkPqppJmPy UKL0Z25OYgWhJsTnnVouqY5HhbFmoQu75bWItZf6zDpHQ7j0cSSARTpUHQsdje2hQB/1 sv3OgAZ70wwosFkK1lEq9sQbt11QIiQRWBkBe80AvNj0jcKGoptBe1UlrnbKU5I+xtYN HqKXB9gnxh6S0g/yvP137VzkNk+Svy/OFq5D6XKmBYgJMu6drPcWw2FmI81gkBhmjOSk iIzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=FTq5uIOs; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d17-20020a056a00199100b0056b972a8cfasi264779pfl.121.2022.10.22.01.07.45; Sat, 22 Oct 2022 01:07:58 -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=FTq5uIOs; 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 S232659AbiJVIHY (ORCPT + 99 others); Sat, 22 Oct 2022 04:07:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36826 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232560AbiJVIC0 (ORCPT ); Sat, 22 Oct 2022 04:02:26 -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 26A292A389D; Sat, 22 Oct 2022 00:51:01 -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 00275B82E2E; Sat, 22 Oct 2022 07:50:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 56FB6C433C1; Sat, 22 Oct 2022 07:50:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425045; bh=fovrxAuJ3o96EOTwBjosV8bf3uk9mILlEB7h0L0riGY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FTq5uIOsyejF94AIvQtqM4JOT7D6eyYS4/0KEvSmNCijXijNLRdmSuNSWM0ZslHw9 LNWkGfTXzBvoyXwrHexQWS6P5z6Aa17CU1Ui0zjvitsEqYINWrp4r/92f8nMoOVYuT e/zHjuSj+2qQTyyMUi5jW92O6Iq+RuswDnpYdssY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Claudiu Beznea , Jonathan Cameron , Sasha Levin Subject: [PATCH 5.19 372/717] iio: adc: at91-sama5d2_adc: check return status for pressure and touch Date: Sat, 22 Oct 2022 09:24:11 +0200 Message-Id: <20221022072513.311158038@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747374391306183008?= X-GMAIL-MSGID: =?utf-8?q?1747374391306183008?= From: Claudiu Beznea [ Upstream commit d84ace944a3b24529798dbae1340dea098473155 ] Check return status of at91_adc_read_position() and at91_adc_read_pressure() in at91_adc_read_info_raw(). Fixes: 6794e23fa3fe ("iio: adc: at91-sama5d2_adc: add support for oversampling resolution") Signed-off-by: Claudiu Beznea Link: https://lore.kernel.org/r/20220803102855.2191070-3-claudiu.beznea@microchip.com Signed-off-by: Jonathan Cameron Signed-off-by: Sasha Levin --- drivers/iio/adc/at91-sama5d2_adc.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/iio/adc/at91-sama5d2_adc.c b/drivers/iio/adc/at91-sama5d2_adc.c index 32b6f157b803..c3301c749164 100644 --- a/drivers/iio/adc/at91-sama5d2_adc.c +++ b/drivers/iio/adc/at91-sama5d2_adc.c @@ -1544,8 +1544,10 @@ static int at91_adc_read_info_raw(struct iio_dev *indio_dev, *val = tmp_val; mutex_unlock(&st->lock); iio_device_release_direct_mode(indio_dev); + if (ret > 0) + ret = at91_adc_adjust_val_osr(st, val); - return at91_adc_adjust_val_osr(st, val); + return ret; } if (chan->type == IIO_PRESSURE) { ret = iio_device_claim_direct_mode(indio_dev); @@ -1558,8 +1560,10 @@ static int at91_adc_read_info_raw(struct iio_dev *indio_dev, *val = tmp_val; mutex_unlock(&st->lock); iio_device_release_direct_mode(indio_dev); + if (ret > 0) + ret = at91_adc_adjust_val_osr(st, val); - return at91_adc_adjust_val_osr(st, val); + return ret; } /* in this case we have a voltage channel */