Re: [PATCH 09/15] iio: light: tsl2591: don't divide by zero in the dark

From: Joshua Crofts

Date: Fri Oct 30 2026 - 04:24:46 EST


On Tue, 27 Oct 2026 17:19:13 +0100
Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> wrote:

> From: Josef Bacik <josef@xxxxxxxxxxxxxx>
>
> The computation of the illuminance divides by the count of channel 0.
> That is the channel which sees the whole spectrum: in complete darkness it
> reads zero, and reading in_illuminance_input divides by zero. Depending
> on the architecture this is an oops, a warning with a backtrace, or goes
> unnoticed.
>
> Report 0 lux in that case.
>
> Fixes: 2335f0d7c790 ("iio: light: Added AMS tsl2591 driver implementation")
> Cc: stable <stable@xxxxxxxxxx>
> Cc: David Lechner <dlechner@xxxxxxxxxxxx>
> Cc: "Nuno Sá" <nuno.sa@xxxxxxxxxx>
> Cc: Andy Shevchenko <andy@xxxxxxxxxx>
> Cc: Josef Bacik <josef@xxxxxxxxxxxxxx>
> Cc: Matheus Silveira <matheus.feitosa@xxxxxx>
> Cc: Lucas Rabaquim <lucas.rabaquim@xxxxxx>
> Cc: Stepan Ionichev <sozdayvek@xxxxxxxxx>
> Cc: Joe Sandom <joe.g.sandom@xxxxxxxxx>
> Signed-off-by: Josef Bacik <josef@xxxxxxxxxxxxxx>
> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
> ---

Reviewed-by: Joshua Crofts <crofts@xxxxxxxxxx>

--
Kind regards,
Joshua Crofts