Re: [PATCH v2 06/14] mfd: zl3073x: Add macros for device registers access

From: Andy Shevchenko
Date: Thu Apr 10 2025 - 13:55:42 EST


On Thu, Apr 10, 2025 at 11:21 AM Ivan Vecera <ivecera@xxxxxxxxxx> wrote:
> On 10. 04. 25 9:17 dop., Krzysztof Kozlowski wrote:
> > On 09/04/2025 16:42, Ivan Vecera wrote:

...

> >> + WARN_ON(idx >= (_num)); \
> >
> > No need to cause panic reboots. Either review your code so this does not
> > happen or properly handle.
>
> Ack, will replace by
>
> if (idx >= (_num))
> return -EINVAL

If these functions are called under regmap_read() / regmap_write() the
above is a dead code. Otherwise you need to configure regmap correctly
(in accordance with the HW registers layout and their abilities to be
written or read or reserved or special combinations).

--
With Best Regards,
Andy Shevchenko