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]
Date:   Wed, 16 Oct 2019 12:25:20 +0200
From:   Jacopo Mondi <jacopo+renesas@...ndi.org>
To:     geert+renesas@...der.be
Cc:     Jacopo Mondi <jacopo+renesas@...ndi.org>,
        linux-iio@...r.kernel.org, linux-renesas-soc@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: [PATCH] iio: adc: max9611: Defer probe on POR read

The max9611 driver tests communications with the chip by reading the die
temperature during the probe function. If the temperature register
POR (power-on reset) value is returned from the test read, defer probe to
give the chip a bit more time to properly exit from reset.

Reported-by: Geert Uytterhoeven <geert+renesas@...der.be>
Signed-off-by: Jacopo Mondi <jacopo+renesas@...ndi.org>

---
Geert,
  I've not been able to reproduce the issue on my boards (M3-N
Salvator-XS and M3-W Salvator-X). As you reported the issue you might be
able to reproduce it, could you please test this?

Also, I opted for deferring probe instead of arbitrary repeat the
temperature read. What's your opinion?

Thanks
   j
---
 drivers/iio/adc/max9611.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/iio/adc/max9611.c b/drivers/iio/adc/max9611.c
index da073d72f649..30ae5879252c 100644
--- a/drivers/iio/adc/max9611.c
+++ b/drivers/iio/adc/max9611.c
@@ -80,6 +80,7 @@
  * The complete formula to calculate temperature is:
  *     ((adc_read >> 7) * 1000) / (1 / 480 * 1000)
  */
+#define MAX9611_TEMP_POR		0x8000
 #define MAX9611_TEMP_MAX_POS		0x7f80
 #define MAX9611_TEMP_MAX_NEG		0xff80
 #define MAX9611_TEMP_MIN_NEG		0xd980
@@ -480,8 +481,10 @@ static int max9611_init(struct max9611_dev *max9611)
 	if (ret)
 		return ret;

-	regval &= MAX9611_TEMP_MASK;
+	if (regval == MAX9611_TEMP_POR)
+		return -EPROBE_DEFER;

+	regval &= MAX9611_TEMP_MASK;
 	if ((regval > MAX9611_TEMP_MAX_POS &&
 	     regval < MAX9611_TEMP_MIN_NEG) ||
 	     regval > MAX9611_TEMP_MAX_NEG) {
--
2.23.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ