From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 72B5FC19F2C for ; Wed, 3 Aug 2022 10:28:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=u7xAyz6wiCWKd6d4amaWVnfSJDHkxCzs0dku93xCb+0=; b=Whu2VShFZRuzf4 rm/xoBveDwZD1B8KDjspMsm2fkdifJ78PdnZN5VaLsTyvcp4Pu8mPkIYXfXcunW0paYP500e6Nwf9 ggu9y/sW0fB5MHhJcVNpglUjC5T+dJU3JTCji6iC+NzU8oMrVz7o68KIIjngMtZpDfbjTSSSiCNXp tfH5NW/pPDgZhMn/qCvapK/3uqpeqkHgSaGyZuWw0Ez2fabbTm5lup0R3qGCer+97S5IheVnpDFcl juGZHiPfdww2ug2ZXooZgfakpgXZYapjMDtMvjgS/Jk0fsPXUEwkCg6RwPsSUMjbT/fGzmfipJl16 AnXmTW1nFZbj+SRoakIQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oJBap-004pT3-2e; Wed, 03 Aug 2022 10:27:11 +0000 Received: from esa.microchip.iphmx.com ([68.232.154.123]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oJBah-004pEy-62 for linux-arm-kernel@lists.infradead.org; Wed, 03 Aug 2022 10:27:05 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1659522422; x=1691058422; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=JpvtSTPUT+P8D09GzxgK5isQg3fgKy4I0OwR91I+YJk=; b=QUzHmQVu5xGVg576YkyxUPPedTNGOpiGSts6LfjMbOzNSnNUc5X0RzuN d3qb0Nh2rStflzcnl0+z2J/45dvxtsTnbMoSfQ3Ni2xO9oOwVGVz8m9mZ OjYMMcJbkzIeuDglNfVK6yENOFdjLtT7pg3sYIsMLGdWqW6kTHosNDNBY E4eBJarhQmsf+Nd6dWnDfPIhyVxtc7DrOSHQm2RByYoNsIcSOwPkMcLXa ricWsDsGk+3k/I+rW4GbYbGoT0sbpVM34pMCFM81TjkiyemqS+co2kzIW bE4xx6ghA44s+9iel6WCbdhXeLAazBnmXpoc/ASITWCvQ+sF8WisPXPUG g==; X-IronPort-AV: E=Sophos;i="5.93,214,1654585200"; d="scan'208";a="107364652" Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa6.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 03 Aug 2022 03:26:46 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.28; Wed, 3 Aug 2022 03:26:44 -0700 Received: from localhost.localdomain (10.10.115.15) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server id 15.1.2375.28 via Frontend Transport; Wed, 3 Aug 2022 03:26:41 -0700 From: Claudiu Beznea To: , , , , , , CC: , , , , Claudiu Beznea Subject: [PATCH v3 02/19] iio: adc: at91-sama5d2_adc: check return status for pressure and touch Date: Wed, 3 Aug 2022 13:28:38 +0300 Message-ID: <20220803102855.2191070-3-claudiu.beznea@microchip.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20220803102855.2191070-1-claudiu.beznea@microchip.com> References: <20220803102855.2191070-1-claudiu.beznea@microchip.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220803_032703_632042_AEFFD050 X-CRM114-Status: GOOD ( 12.23 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 --- 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.34.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel