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-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 21 Aug 2019 13:28:16 +0200
From:   Geert Uytterhoeven <geert@...ux-m68k.org>
To:     Jonathan Cameron <jic23@...nel.org>,
        Jacopo Mondi <jacopo+renesas@...ndi.org>
Cc:     Hartmut Knaack <knaack.h@....de>,
        Lars-Peter Clausen <lars@...afoo.de>,
        Peter Meerwald-Stadler <pmeerw@...erw.net>,
        Kuninori Morimoto <kuninori.morimoto.gx@...esas.com>,
        Stefan Agner <stefan@...er.ch>, linux-iio@...r.kernel.org,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        Linux-Renesas <linux-renesas-soc@...r.kernel.org>,
        stable <stable@...r.kernel.org>
Subject: Re: [PATCH] iio: adc: max9611: Fix temperature reading in probe

Hi Jonathan, Jacopo,

On Mon, Aug 5, 2019 at 7:15 PM Jonathan Cameron <jic23@...nel.org> wrote:
> On Mon,  5 Aug 2019 17:55:15 +0200
> Jacopo Mondi <jacopo+renesas@...ndi.org> wrote:
>
> > 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 <jacopo+renesas@...ndi.org>
>
> Applied to the fixes-togreg branch of iio.git and marked for
> stable.  That'll be a bit fiddly given other changes around this
> so we may need to do backports.

This is now commit b9ddd5091160793e ("iio: adc: max9611: Fix temperature
reading in probe") in v5.3-rc5, and has been backported to 4.14, 4.19,
and 5.2.

> > --- 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) ||

While this did fix a bug, it also introduced a regression: on Salvator-XS,
which has two max9611 instances, I now see intermittent failures

    max9611 4-007c: Invalid value received from ADC 0x8000: aborting
    max9611: probe of 4-007c failed with error -5

and/or

    max9611 4-007f: Invalid value received from ADC 0x8000: aborting
    max9611: probe of 4-007f failed with error -5

during boot.

Retrying on failure fixes the issue, e.g.:

    max9611_init:483: regval = 0x8000
    max9611 4-007f: Invalid value received from ADC 0x8000: aborting
    max9611_init:483: regval = 0x2780

According to the datasheet, 0x8000 is the Power-On Reset value.
Looks like it should be ignored, and retried?

Gr{oetje,eeting}s,

                        Geert


--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@...ux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ