Re: [PATCH] iio: humidity: hts221: fix division by zero in calibration data parsing
From: Andy Shevchenko
Date: Tue Sep 01 2026 - 02:58:18 EST
On Tue, Sep 01, 2026 at 02:35:44AM +0100, Jonathan Cameron wrote:
> On Mon, 31 Aug 2026 10:05:06 +0300
> Andy Shevchenko <andriy.shevchenko@xxxxxxxxx> wrote:
> > On Mon, Aug 31, 2026 at 01:00:21AM +0100, Jonathan Cameron wrote:
> > > On Wed, 26 Aug 2026 17:09:49 +0300
> > > Andy Shevchenko <andriy.shevchenko@xxxxxxxxx> wrote:
> > > > On Tue, Aug 25, 2026 at 05:21:10PM +0800, Yang Zi wrote:
...
> > > > Do you have HW to test? Any fault injection perhaps?
> > > > The problem with div-by-0 is that it's implementation defined, meaning
> > > > that it's how compiler decides. Now, the question is, what will compiler
> > > > do in the current code (no patch applied)?
> > > >
> > > Whilst all this is true, the code shouldn't be relying on any particular
> > > behavior. So do we need to know?
> >
> > That's my point. If code relies on that, it should be spelled clearly in
> > the commit message. Then we will deliberately break that (nasty and wrong)
> > behaviour.
>
> Ah. Got you. So a statement that the condition (probably) never occurs in practice
> should do the job here by side stepping that question.
Yep!
> > > Reality is the hardware is almost certainly never returning values where this
> > > is true.
--
With Best Regards,
Andy Shevchenko