Re: [PATCH 10/15] iio: light: tsl2591: don't divide by zero with low gain

From: Greg Kroah-Hartman

Date: Wed Oct 28 2026 - 00:17:18 EST


On Wed, Oct 28, 2026 at 02:13:02AM +0000, Jonathan Cameron wrote:
> On Tue, 27 Oct 2026 17:19:14 +0100
> Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> wrote:
>
> > From: Josef Bacik <josef@xxxxxxxxxxxxxx>
> >
> > The number of counts per lux is the integration time in milliseconds times
> > the gain, divided by 408. With the low gain, which is 1, and an
> > integration time of 100 to 400 ms, that is 0 in integer arithmetic, and
> > each read of the illuminance divides by zero.
> >
> > In that case, multiply by the coefficient and divide by the product
> > instead. The result of the other settings does not change.
> >
> https://lore.kernel.org/all/20261022-first-patch-v4-0-90b2fc6e8e28@xxxxxxxxxxxxxxx/
>
> I have first few of that series queued up already.

Wonderful, thanks! Proof again that people keep finding the same bugs
at the same time with these tools :)

greg k-h