linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Alexander Zangerl <az@breathe-safe.com>
Cc: Jonathan Cameron <Jonathan.Cameron@Huawei.com>,
	Lars-Peter Clausen <lars@metafoo.de>,
	Hartmut Knaack <knaack.h@gmx.de>,
	Peter Meerwald-Stadler <pmeerw@pmeerw.net>,
	linux-iio@vger.kernel.org, Tomasz Duszynski <tduszyns@gmail.com>
Subject: Re: [PATCH v1] iio: pressure: ms5611: ms5611_prom_is_valid false negative bug
Date: Sat, 30 Sep 2023 18:37:48 +0100	[thread overview]
Message-ID: <20230930183748.2f20a00a@jic23-huawei> (raw)
In-Reply-To: <2535-1695168070.831792@Ze3y.dhYT.s3fx>

On Wed, 20 Sep 2023 10:01:10 +1000
Alexander Zangerl <az@breathe-safe.com> wrote:

> the ms5611 driver falsely rejects lots of MS5607-02BA03-50 chips
> with "PROM integrity check failed" because it doesn't accept a prom crc
> value of zero as legitimate.
> 
> according to the datasheet for this chip (and the manufacturer's
> application note about the prom crc), none of the possible
> values for the crc are excluded - but the current code
> in ms5611_prom_is_valid() ends with
> 
> return crc_orig != 0x0000 && crc == crc_orig
> 
> i've discussed this with the original author of the driver (tomasz
> duszynski) and he indicated that at that time (2015) he was dealing with
> some faulty chip samples which returned blank data under some
> circumstances and/or followed example code which indicated crc zero
> being bad (i can't find any traces of any such online, however).
> 
> as far as i can tell this exception should not be applied anymore; we've
> got a few hundred custom boards here with this chip where large numbers
> of the prom have a legitimate crc value 0, and do work fine, but which the
> current driver code wrongly rejects.
> 
> Signed-off-by: Alexander Zangerl <az@breathe-safe.com>
> Fixes: c0644160a8b5 ("iio: pressure: add support for MS5611 pressure and temperature sensor")

Applied with some tweaks to the patch description to shorten it
a little whilst keeping all the information.  Also marked for stable inclusion.

Applied to the fixes-togreg branch of iio.git

Thanks,

Jonathan

> ---
>  drivers/iio/pressure/ms5611_core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/pressure/ms5611_core.c b/drivers/iio/pressure/ms5611_core.c
> index 5c7a734ede54..9980c6f3335e 100644
> --- a/drivers/iio/pressure/ms5611_core.c
> +++ b/drivers/iio/pressure/ms5611_core.c
> @@ -79,7 +79,7 @@ static bool ms5611_prom_is_valid(u16 *prom, size_t len)
>  
>  	crc = (crc >> 12) & 0x000F;
>  
> -	return crc_orig != 0x0000 && crc == crc_orig;
> +	return crc == crc_orig;
>  }
>  
>  static int ms5611_read_prom(struct iio_dev *indio_dev)


      reply	other threads:[~2023-09-30 17:37 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-17 23:52 iio: pressure: ms5611: ms5611_prom_is_valid false negative bug [PATCH] Alexander Zangerl
2023-09-18 11:05 ` Jonathan Cameron
2023-09-20  0:01   ` [PATCH v1] iio: pressure: ms5611: ms5611_prom_is_valid false negative bug Alexander Zangerl
2023-09-30 17:37     ` Jonathan Cameron [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230930183748.2f20a00a@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=Jonathan.Cameron@Huawei.com \
    --cc=az@breathe-safe.com \
    --cc=knaack.h@gmx.de \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=pmeerw@pmeerw.net \
    --cc=tduszyns@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).