From patchwork Mon Oct 24 11:30:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9851 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp558944wru; Mon, 24 Oct 2022 10:05:36 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7MPv9UrQvEQQ3WUHlv/UbKrqtbI5ZrSBvDelRApgnAqN6patqNe3Eq0yNVEfrsFXeeklR9 X-Received: by 2002:a17:90b:4a43:b0:212:fd76:be5d with SMTP id lb3-20020a17090b4a4300b00212fd76be5dmr10276007pjb.152.1666631136388; Mon, 24 Oct 2022 10:05:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666631136; cv=none; d=google.com; s=arc-20160816; b=m1M0PDDGFrQwU3X/tr+ynT4T/NXXxoiOHdKGQ7rvGoXK9+1AKGxAiri+KqlN9loRhA 8W9XmcrQUq9NZ9jRm+7JXuZe9hf92IZ567wHKHAXlskAjanZN/14hybsOKnmwMznrK5T fRa+g9FS+9zhd2cbcVW4Wv/Ej/DuQpr5MllWng2kqitL/vfx/+38mwIL2RdC6/UEY42A VGwGghNWuBUeQtX6jQgH2xgVYdFEJJHFrYfZOYGimAPW3wU+u/u1gDZk1EUw/ntAW6Ob j8sxQyIVolPLiVyZmlgM9Azdvu4eUB6BeSr80HtVwLzN1D+VHKZ5499frDWtrwQSbqo6 e9DA== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 79-20020a630452000000b0045160a30fcasi1852pge.388.2022.10.24.10.05.21; Mon, 24 Oct 2022 10:05:36 -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 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?1747589410419329210?= X-GMAIL-MSGID: =?utf-8?q?1747589410419329210?= 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 */