From patchwork Mon Oct 24 11:30:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8933 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp434890wru; Mon, 24 Oct 2022 05:53:13 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6rcCwLMTEGUe5Vtxl2j+6kR4cA1gNdikacEnFsfDI5XRvLs37QnnfLiQQpg09sYlOPe5wf X-Received: by 2002:a17:906:fe45:b0:788:15a5:7495 with SMTP id wz5-20020a170906fe4500b0078815a57495mr27811191ejb.633.1666615993303; Mon, 24 Oct 2022 05:53:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615993; cv=none; d=google.com; s=arc-20160816; b=E2V31NoWz0ndiQPYYgTAfRCJgdK95Avum+AKQX97xvVTJqexFAu+bVj3iM1kgNrbr+ gSdx65IdQ4Ty6RkOploO1+RCiy6tfrx68ZwWc2xGhtNAjGHtQlRX8R4Z8U5x5TMtCoem svIIXYKkBHGeGsj1nJx/PfR/Ej6bLh7f3cbitAqGUPKghzSOa2ih8YvfrY9364TnB/k4 UB5IZRfK42lpC4XRn2i8tLYDxUo/jgeD8MiV1QVDiXh9dRUh+Dw8m/uBVhtYRfmcMxZ7 AhpplgZAQFJohce7hTzXZnFgaHP4XAYGIHQmNTfr/oFb6+XzuqiLahr+l7R2raKHOL3O Houg== 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=qEiJ/svzP79ah2dA+srjN+97a6ewVNlURk/Uk6YADuo=; b=d+mQ6qNXv3ZpNEy4z7kx4KRm8YlMEj2qoNZ8BtRY5tcaBOFsPurkeTe0EdgI9cRHMw 4fypHkP8TkEsZmvyNEimNLqR/uRG3pdO/XSqNFefNjCANXJCdGKmV0QPScBCAf8AAc7t 5MBdtruIB6sHpSwgClYFRwjYYHeVOhv1qA3koMBujsj0NPWoxQ1xLeXVyzEUY/eaQek0 cTxPqV4E5d6rXDrS5U42QnVT95RkoeJyttNfPYHuU5RmEAB02i39vQrOPk/SMCX3pbnk qwNm3Ucxo7jdAvWAsCI5eIUu64BIYRLAi22NXiX4fIQbNIGZsCE4IetgdK7XYrAQBwbt 2InQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=HyvjqScG; 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 e14-20020a17090658ce00b007a6ae47c314si4504845ejs.539.2022.10.24.05.52.47; Mon, 24 Oct 2022 05:53: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=HyvjqScG; 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 S234584AbiJXMvv (ORCPT + 99 others); Mon, 24 Oct 2022 08:51:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43998 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234775AbiJXMpk (ORCPT ); Mon, 24 Oct 2022 08:45:40 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 16F7A4A82E; Mon, 24 Oct 2022 05:10:05 -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 315C0612A4; Mon, 24 Oct 2022 12:09:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 40EF0C433C1; Mon, 24 Oct 2022 12:09:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613395; bh=5KeHGDA8jHkPEmGTI8j1RHcmYxHd7OcD4B7p3LSoRwk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HyvjqScGsy0cOjdU8OQI3LG0MObSwH5aYm9ivKkGodntoJHyFI9e6el6fkXuNBuak NBsGBJm0zqdM0bHtrrvDdOsLM9XnBnMF0lcJTepVI9vQXe4P+sxFtC+RP2/3hSr2IX ByOCvc930utQkjg98cYko8NMB48zWQ9u+7yeVMyU= 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.4 119/255] iio: adc: at91-sama5d2_adc: check return status for pressure and touch Date: Mon, 24 Oct 2022 13:30:29 +0200 Message-Id: <20221024113006.476298258@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@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?1747573531365982536?= X-GMAIL-MSGID: =?utf-8?q?1747573531365982536?= 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 090cc1e8b4ea..20ef858d65c7 100644 --- a/drivers/iio/adc/at91-sama5d2_adc.c +++ b/drivers/iio/adc/at91-sama5d2_adc.c @@ -1323,8 +1323,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); @@ -1337,8 +1339,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 */