From patchwork Wed Oct 19 08:29:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 5099 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp250129wrs; Wed, 19 Oct 2022 03:48:13 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5I65rtVdp8jYo06CN7iFx/dk2ymFTu3It++Nrwy805g9dCmLexTJxdI4MTnPYdp96bkQ6z X-Received: by 2002:a17:907:60d5:b0:78d:f741:7f9b with SMTP id hv21-20020a17090760d500b0078df7417f9bmr6071542ejc.314.1666176493816; Wed, 19 Oct 2022 03:48:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666176493; cv=none; d=google.com; s=arc-20160816; b=qiQKyA5dujAZsCB0dOzYvyTXQjPWRYWRvsI1CQnHYQs7aHrYv13TTL4Dt9S2QYkINV 1x0a3NN61Rg5m8eM12m7d3AaG8fawtmRaY2Yt/Kv6EF4V9lFnEUlYFdGMtAj1OC/INfg xgILtK6G/8UKAA7vtNQAyDMIt9/eQUkurO6Q2uSui/TqIgpIMg7AiSPaEaVBoafKK+iZ Jdu5/1hHYg8s1iHcyYr+fdRvcL7C5hwUjvEcIR999qjBHnq/hHcyxbW7DYgvmFfpeHz+ JiLMcfwGrKfYc1Yu4vTSpM1WfJq05U6mMp4Me+9OczAhaeraMCUaxwnGpMPCAhTNuVlR Nu0A== 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=M2XBoYlPyw0tMtZtA98+fnxbXIJaSCC3fwC/B5jtNk0=; b=eQYq3pqoLUYAR14RqX9HKkqz+6SOhTydLgxf8s5TFXOghkvERAP49xsPMDmdpVOXLy aCmcYwDScGAhnrRGkAqGdKDG2wMYgDxpyZR5jAaquoCnIUlPfWxhQRqRNlC0zjo6HIw6 L7k549DfwLFjtsz8kbhxypum2eFwhBrhNJp+56p4gotAH6SyiSXrYeCSPSD+mZdyQuEf xpnb1Tw41T1js54Ipbye7wbtQoQER/N6pdN/RES2DTKFbkYM1cQVEOoI0GfklAT6fswP UvSfTSBHSLYaqVj9WD/lUpzEwtZBE4dyuVBAkNz7KOhy4vmQKrNyFd624nevicSiWugh UuYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=PNgXNbgl; 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 m22-20020a1709062ad600b0078e11e9286csi11124669eje.195.2022.10.19.03.47.48; Wed, 19 Oct 2022 03:48:13 -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=PNgXNbgl; 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 S232948AbiJSKrV (ORCPT + 99 others); Wed, 19 Oct 2022 06:47:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45558 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232371AbiJSKoz (ORCPT ); Wed, 19 Oct 2022 06:44:55 -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 35F1411A960; Wed, 19 Oct 2022 03:21:27 -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 7C97DB8243C; Wed, 19 Oct 2022 08:58:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CCDBFC433C1; Wed, 19 Oct 2022 08:58:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169917; bh=6XTF//5sVQnIk1y2riU7wOGu4n69UIB2ssUQRpMAKnA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PNgXNbglldMQP/OYChoNcwrxL2V0Rj3aOYGSJng6n/5estxDKEtTZSApksuF/Dhtt gjF0QpnNSyBBhBYd+F0l+iUH+E+wogfbAPXsRLUvRPA7TktkwKAPXkAaKPtCpBd9x0 FHFSzdVglVVLH2CCNivbLaui0EDD5elZVzrJ9YxQ= 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 6.0 458/862] iio: adc: at91-sama5d2_adc: check return status for pressure and touch Date: Wed, 19 Oct 2022 10:29:05 +0200 Message-Id: <20221019083310.224242008@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 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?1747112682954025530?= X-GMAIL-MSGID: =?utf-8?q?1747112682954025530?= 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 ac9ef89fba17..08d1f806c839 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 */