Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp900210rwi; Wed, 19 Oct 2022 04:30:54 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6ICIW/s7wMCbpDorA9J7uHL8kj3PdaGxInP2ETK0F6nRXpppgawlLQEhbhKCu6EiY6OHYU X-Received: by 2002:a17:90b:33cd:b0:20d:9da6:56e3 with SMTP id lk13-20020a17090b33cd00b0020d9da656e3mr39587913pjb.143.1666179053934; Wed, 19 Oct 2022 04:30:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666179053; cv=none; d=google.com; s=arc-20160816; b=MLsyVxTjF0oPytEX7PhE1fJqSxzyT+eva/lNVitPac5mLNwQzggn4NoOduZQ5FEkEm 0lrp4KHKK9l8iyCneyHFo8h5eoA7N+GAt/6drFaZNuvsYlNDeDVnulr6wnOOE5u+sUb7 Ew3Df6x/85FAflQGk0klZxUA/q40Enj/a5StCNEoQw+9E+cHvz/bKMp7yaDr3PWJU4Mz Y7AhCj+C+ONxqwTydWGn14TJU+qDnScykge0R4bUeomuqJZKEOFw7wHw1BL2FM4SDpdo Wz9lYMpe8TB5GrWW36bgy0QE3/Hq0qq7E7OlK5HRQ9fH26lgDh339TmpizR+9LracUCe HZmw== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a16-20020a17090abe1000b0020d5c7ae3cbsi15832568pjs.38.2022.10.19.04.30.40; Wed, 19 Oct 2022 04:30:53 -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 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 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 */ -- 2.35.1