lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20231018152816.56589-1-ak@it-klinger.de>
Date:   Wed, 18 Oct 2023 17:28:16 +0200
From:   Andreas Klinger <ak@...klinger.de>
To:     Jonathan Cameron <jic23@...nel.org>
Cc:     Lars-Peter Clausen <lars@...afoo.de>,
        Angel Iglesias <ang.iglesiasg@...il.com>,
        Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
        Linus Walleij <linus.walleij@...aro.org>,
        Sergei Korolev <dssoftsk@...il.com>, linux-iio@...r.kernel.org,
        linux-kernel@...r.kernel.org, Andreas Klinger <ak@...klinger.de>
Subject: [PATCH] iio: bmp280: fix eoc interrupt usage

Only the bmp085 can have an End-Of-Conversion (EOC) interrupt. But the
bmp085 and bmp180 share the same chip id. Therefore it's necessary to
distinguish the case in which the interrupt is set.

Fix the if statement so that only when the interrupt is set and the chip
id is recognized the interrupt is requested.

This bug exists since the support of EOC interrupt was introduced.
Fixes: aae953949651 ("iio: pressure: bmp280: add support for BMP085 EOC interrupt")

Also add a link to bmp085 datasheet for reference.

Suggested-by: Sergei Korolev <dssoftsk@...il.com>
Signed-off-by: Andreas Klinger <ak@...klinger.de>
---
 drivers/iio/pressure/bmp280-core.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/iio/pressure/bmp280-core.c b/drivers/iio/pressure/bmp280-core.c
index 6089f3f9d8f4..9b7beeb1c088 100644
--- a/drivers/iio/pressure/bmp280-core.c
+++ b/drivers/iio/pressure/bmp280-core.c
@@ -9,6 +9,7 @@
  * Driver for Bosch Sensortec BMP180 and BMP280 digital pressure sensor.
  *
  * Datasheet:
+ * https://www.sparkfun.com/datasheets/Components/General/BST-BMP085-DS000-05.pdf
  * https://cdn-shop.adafruit.com/datasheets/BST-BMP180-DS000-09.pdf
  * https://www.bosch-sensortec.com/media/boschsensortec/downloads/datasheets/bst-bmp280-ds001.pdf
  * https://www.bosch-sensortec.com/media/boschsensortec/downloads/datasheets/bst-bme280-ds002.pdf
@@ -2179,7 +2180,7 @@ int bmp280_common_probe(struct device *dev,
 	 * however as it happens, the BMP085 shares the chip ID of BMP180
 	 * so we look for an IRQ if we have that.
 	 */
-	if (irq > 0 || (chip_id  == BMP180_CHIP_ID)) {
+	if (irq > 0 && (chip_id  == BMP180_CHIP_ID)) {
 		ret = bmp085_fetch_eoc_irq(dev, name, irq, data);
 		if (ret)
 			return ret;
-- 
2.39.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ