Received: by 2002:a25:b794:0:0:0:0:0 with SMTP id n20csp2915630ybh; Mon, 5 Aug 2019 08:54:54 -0700 (PDT) X-Google-Smtp-Source: APXvYqxiElyOXX795oJQLWM4+eXbP1dKFbSf1zSa8oO1BDd3eC+jq/W5WOTipDrrMwewrLtYLbaQ X-Received: by 2002:a17:90a:e397:: with SMTP id b23mr18946639pjz.117.1565020494236; Mon, 05 Aug 2019 08:54:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565020494; cv=none; d=google.com; s=arc-20160816; b=YjWNh9GBxFEz7AjlnDnUoP2cRtcf/C1+1xzBluJt+wrkia1ddFb8uMaP/ecwLo1Bl8 WO5sNJPNcagFE16MJtC/ccC+vlU4HiSILGy5pqkLq7Gi9iZa4zJQrAo6CPpyEE6oRCms kdy1SmuQCCpii4dtBZwIvvs/qNWfbAJS2E8CivHZtX8dwvJ2X4c3PAVUwXiZtWumQIQZ sY37Grmt5M8IbjRj1L+FMSIUCg1H1vLN6HC6QXE8pFS2QthgLqC/dBQ0y2FpePT+VUMu ajgIZYopHEAZKBDMwew1BZn+0YKIjYBbyavKMqEQI2YZw7CQnf0tarFftO/FhPEmxSzI /jfw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=ZCQElHmaPQ0aRtDXaE5eU453yX0eR8HifXVyJnnWvrs=; b=W2n9PiFvZIrZDIQr/YJJ9D1RH9S/JGbyOa1uC/Hu37ggDSYPgo8focvWcHbwTKPlAH PWrlZtU9k0lUnMYHd11lTQQ62n6FMNtNzlpPjDumm3YXKuX1TqEKOBkplPRN1dZNEhaK KmwlsQ+UvbvLiarF0gP6mJ2ot0ONTLfBfdwCH+LZdMpe7iZOt2N7ZdI819PhUrGifsd5 mjQNk7oTZBCWnAP+ZmnrcWZoHijne21Hq+KpAputnegLEdZ0v47/GlS/lo0VyvIXpTcr sJRLBFSbPIOBX6K08XI8prLByxctxBmAR9bk/F2N40uSLzDTEFXSMaGbHGH2yNITrbJe +DnQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d10si41518501pla.135.2019.08.05.08.54.37; Mon, 05 Aug 2019 08:54:54 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728919AbfHEPyE (ORCPT + 99 others); Mon, 5 Aug 2019 11:54:04 -0400 Received: from relay10.mail.gandi.net ([217.70.178.230]:51777 "EHLO relay10.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726559AbfHEPyE (ORCPT ); Mon, 5 Aug 2019 11:54:04 -0400 Received: from uno.homenet.telecomitalia.it (host150-24-dynamic.51-79-r.retail.telecomitalia.it [79.51.24.150]) (Authenticated sender: jacopo@jmondi.org) by relay10.mail.gandi.net (Postfix) with ESMTPSA id B217B240009; Mon, 5 Aug 2019 15:54:00 +0000 (UTC) From: Jacopo Mondi To: Jonathan Cameron , Hartmut Knaack , Lars-Peter Clausen , Peter Meerwald-Stadler , Kuninori Morimoto , Stefan Agner Cc: Jacopo Mondi , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] iio: adc: max9611: Fix temperature reading in probe Date: Mon, 5 Aug 2019 17:55:15 +0200 Message-Id: <20190805155515.22621-1-jacopo+renesas@jmondi.org> X-Mailer: git-send-email 2.22.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The max9611 driver reads the die temperature at probe time to validate the communication channel. Use the actual read value to perform the test instead of the read function return value, which was mistakenly used so far. The temperature reading test was only successful because the 0 return value is in the range of supported temperatures. Fixes: 69780a3bbc0b ("iio: adc: Add Maxim max9611 ADC driver") Signed-off-by: Jacopo Mondi --- drivers/iio/adc/max9611.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/adc/max9611.c b/drivers/iio/adc/max9611.c index 917223d5ff5b..e9f6b1da1b94 100644 --- a/drivers/iio/adc/max9611.c +++ b/drivers/iio/adc/max9611.c @@ -480,7 +480,7 @@ static int max9611_init(struct max9611_dev *max9611) if (ret) return ret; - regval = ret & MAX9611_TEMP_MASK; + regval &= MAX9611_TEMP_MASK; if ((regval > MAX9611_TEMP_MAX_POS && regval < MAX9611_TEMP_MIN_NEG) || -- 2.22.0