[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CA+NOmz+KKhSAX8cEUhcS=GPCTtagyFZS4Pszj895bf-07ii7bw@mail.gmail.com>
Date: Wed, 11 Feb 2026 00:29:15 +0800
From: Yasin Lee <yasin.lee.x@...il.com>
To: Andy Shevchenko <andriy.shevchenko@...el.com>
Cc: Jonathan Cameron <jic23@...nel.org>, David Lechner <dlechner@...libre.com>,
Nuno Sá <nuno.sa@...log.com>,
Andy Shevchenko <andy@...nel.org>, Rob Herring <robh@...nel.org>,
Krzysztof Kozlowski <krzk+dt@...nel.org>, Conor Dooley <conor+dt@...nel.org>, yasin.lee.x@...look.com,
linux-iio@...r.kernel.org, linux-kernel@...r.kernel.org,
devicetree@...r.kernel.org
Subject: Re: [PATCH 2/5] iio: proximity: hx9023s: Protect against division by
zero in set_samp_freq
On Mon, Feb 9, 2026 at 4:46 PM Andy Shevchenko
<andriy.shevchenko@...el.com> wrote:
>
> On Mon, Feb 09, 2026 at 11:37:03AM +0800, Yasin Lee wrote:
> > Avoid division by zero when sampling frequency is unspecified by
> > falling back to a default 100ms sampling period.
>
> Fixes tag?
>
This is a proactive fix for an original implementation issue I found
as maintainer.
> ...
>
> > + if (!val && !val2)
>
> What's wrong with the positive conditional?
>
Agreed. Positive conditional will be present in v2.
> if (val || val2)
> ...
> else
> ...
>
> > + /* Fallback to a safe default sampling period */
> > + period_ms = 100;
> > + else
> > + period_ms = div_u64(NANO, (val * MEGA + val2));
>
> --
> With Best Regards,
> Andy Shevchenko
>
>
Powered by blists - more mailing lists