From patchwork Mon Oct 24 11:29:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9119 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp456243wru; Mon, 24 Oct 2022 06:33:50 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6kftEr8eaZG2tF0Oz5QUWFi4At6FfY1nrUB6ooWOMQ+5M992Hc4g5dWbJ/6EcEz/6gNqqS X-Received: by 2002:a17:906:d550:b0:78d:a6d4:c18f with SMTP id cr16-20020a170906d55000b0078da6d4c18fmr28140774ejc.113.1666618430624; Mon, 24 Oct 2022 06:33:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618430; cv=none; d=google.com; s=arc-20160816; b=G7aDMlG6tVbXxAEsvoUJ0jj3SsenV5QJixF4aDJQeyL3qs2p+Ygy/K4BSn4IsOH7GZ mTE8usHsedZ03LDL9tQhf5DlFpwfUd8GGsc6IWMS1ZNBJFXFbtuTq9txIy0+5rRK6Xa0 HzVWKw3XtsTjSt+1cELx5Gsyjkgatr5MSsKujiBzIoXdQBTYVv8iMQ1R7heQZ0ek/Boe +H48RYBMwC4ZU8D3hGI12hVxuRu+Xb5LXBlGWNMm+Be5Q2JFnBPdp9zt/msRVi5TtZKf 2p8pAD1juN8t6hzHTaKk0lCxn8Y//Ew9RE1mCYH2d/8ucgXKaDnGpZrx5yg7+FBTk0FE BuMg== 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=6wNWkSIY18wXdm8lh+rORcbf2hPBf/u4bKiGxbHwYS8=; b=sYZOmZGVsRm1LGd5HbF41gkf6mhA9fQGzpHVrmulruuXwB7ncc4AK/+R5iZJmcmr7V 6ABIzcP/hyTJlo6vm9T3IM3s32SyoP9V2E3euxNaSnL432IUZIJRyDvptLMGLJcwdkKI 4t1Uzv50UhEdGdOmUuIs3efNFpAL/vxQQmMs4gUd7Lvz76KoPRtkhcdnoDs2s1cWGVAH YLGrSzaZM97xxhAJyaaObzXisf1VB8C1bnStvJkJB+wQiZAS90q2BSCIyOVxeulrBKhU UgAtqntlCN26ANLVO1nsU0+SppkDvCL8yFp+1PiZ65e5D9H+Amci16HEJQ7c+DhjsgF7 MMaQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=KXsGGbew; 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 jg36-20020a170907972400b007a00aaf659csi7290711ejc.198.2022.10.24.06.33.22; Mon, 24 Oct 2022 06:33:50 -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=KXsGGbew; 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 S233651AbiJXNRS (ORCPT + 99 others); Mon, 24 Oct 2022 09:17:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57706 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235880AbiJXNQ3 (ORCPT ); Mon, 24 Oct 2022 09:16:29 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7C0683136F; Mon, 24 Oct 2022 05:26:00 -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 3A99E612BF; Mon, 24 Oct 2022 12:25:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4F0FDC433C1; Mon, 24 Oct 2022 12:25:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614326; bh=nF7UiDWwEbfZz17cexrmnfVr+/EPs45zvkqcJM7ZsSk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KXsGGbewz9fboYu6L1vTZ7zLl9ZvflAbMVMv83QDwe+kf4/7A7rTSEJKgyx/K7o1m SMzvRIX9pTGX03cCk6/kzCvaQbcg1iHrAzSmXr7KMmWg8LiY0AXgk6DvheDLSAwwRG pcoowAXQgfDHT87TtQguVuG6ifvJQKO2Ji2iVcLk= 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.10 186/390] iio: adc: at91-sama5d2_adc: check return status for pressure and touch Date: Mon, 24 Oct 2022 13:29:43 +0200 Message-Id: <20221024113030.684509472@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 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?1747576087802194775?= X-GMAIL-MSGID: =?utf-8?q?1747576087802194775?= 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 230e4111517e..fe41689c5da6 100644 --- a/drivers/iio/adc/at91-sama5d2_adc.c +++ b/drivers/iio/adc/at91-sama5d2_adc.c @@ -1355,8 +1355,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); @@ -1369,8 +1371,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 */