Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp7147799rwi; Mon, 24 Oct 2022 10:23:09 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5U56oW9WrSssMDKaTm4K87/17jpdPnGJ3PHmzS5mM78zNIyBqA35l2tCPFWz2wUHwHDuT5 X-Received: by 2002:a63:8643:0:b0:46b:2bef:338b with SMTP id x64-20020a638643000000b0046b2bef338bmr29231162pgd.357.1666632189331; Mon, 24 Oct 2022 10:23:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666632189; cv=none; d=google.com; s=arc-20160816; b=GIcKdHBpltOwZpIavKbOnjeh4O3WQaEGX61c5k+ONHlDqX5mff6KOVk9td7qMX66Gl cHKf4HcVRV8utV0a51Dp6Tf5ofq+qpXTF+dybgIxzZKYt8VkOAY7aUeAut2xWUvCTZnp VgZ18qvnRQu+Dg4D8SiaCQLIV42EEXr3q9QiLJv7+qGoP49SaK/4rGqOwumqFDMC/WyS Q1w+v0XQrxN9A8wrC7aXoyLgNNRA/brZI0Px6FGGcAOlHt2u0k335sE22dAFtW9LtIux 7v2qRzIx8sjTsqtIN+TCeldh39a51waoiKMskRekC1SeotlLOaU03mSfH8oANAHsWhqr S0Eg== 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=yV3pkWfv6OMNCV4c6KKrqIEi5usPp890RI/pkRvyeJM=; b=lGAO7fPnBJK1RuMAXr7TpIuxkCakNClXU8OGAVtQrURXEM1ePOTmj1vtjXolTTRNQS ldXbDj/3cHVFAwr0RLYWlhue2TTd98kP/DvElBHc9W4jV+y8IttFAX3XKKUri0FVZaef /k9rB48lw+X8lpIgfmSRRhDqUJkKoEhkF1FeXvQsVw/ByKLBJWvaVYIKNFHykdutDgKA +Yg5UxQrGJ3GA9Dw7zj11XQ1JUQDEE2JMhquPe1TZwrHUYqAPbZXgBy56zp4XQhB/dZR ddf8tKMp4HtCiiFtDEx5KOrB5qjvBRodmfuY/COFwnJp8GuSsoAeMlgx4YI843JGSD3X 0PqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=JOuH62u1; 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 y18-20020a170902d65200b0017d2c45e93fsi52438plh.169.2022.10.24.10.22.57; Mon, 24 Oct 2022 10:23:09 -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=JOuH62u1; 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 S231693AbiJXRAj (ORCPT + 99 others); Mon, 24 Oct 2022 13:00:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57926 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232254AbiJXQ6Z (ORCPT ); Mon, 24 Oct 2022 12:58:25 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 15D4B43600; Mon, 24 Oct 2022 08:37:17 -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 18594B81217; Mon, 24 Oct 2022 12:00:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6EF7FC433D6; Mon, 24 Oct 2022 12:00:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612856; bh=HG44hPgTBmWsbYCtnrIvirEw6ej6b3jB0V16siZzCW0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JOuH62u1icqRJpcRqs+gf9R41VRDXQ8Yf49RUmdpY7jhgpMoiUqaV8uXQw5Jb3SHb rxGg6krjoNi62fW+c30b/uhzsqHFWF+U598wNz86EAd0eLBmxpmYIWxmLgIVUMlsQv AVZpDCjN9nbivPyn09Ok6wc8au863MjUutyGzrQ4= 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 4.19 118/229] iio: adc: at91-sama5d2_adc: check return status for pressure and touch Date: Mon, 24 Oct 2022 13:30:37 +0200 Message-Id: <20221024113002.811943227@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@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.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 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 141badb8707e..b355899f54cc 100644 --- a/drivers/iio/adc/at91-sama5d2_adc.c +++ b/drivers/iio/adc/at91-sama5d2_adc.c @@ -1329,8 +1329,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); @@ -1343,8 +1345,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 */ -- 2.35.1