Re: [PATCH v2 2/4] iio: proximity: hx9023s: Protect against division by zero in set_samp_freq
From: Andy Shevchenko
Date: Thu Feb 12 2026 - 15:02:16 EST
On Fri, Feb 13, 2026 at 12:44:57AM +0800, Yasin Lee wrote:
> On Thu, Feb 12, 2026 at 6:56 PM Andy Shevchenko
> <andriy.shevchenko@xxxxxxxxx> wrote:
> > On Thu, Feb 12, 2026 at 02:26:53PM +0800, Yasin Lee wrote:
...
> > Not sure about this. Perhaps we should rather do
> >
> > if (!val || !val2)
> > return -EINVAL;
> >
> > ?
>
> Agreed. I will update this in v3 as below .
> ...
> if (!val && !val2)
> return -EINVAL;
> period_ms = div_u64(NANO, val * MEGA + val2);
Then don't touch parentheses, as the line will have nothing to do with
the scope of the patch.
--
With Best Regards,
Andy Shevchenko