Re: [PATCH v1 2/8] media: ov2740: Replace voodoo coding with understandle flow

From: Andy Shevchenko
Date: Fri Nov 11 2022 - 10:32:47 EST


On Fri, Nov 11, 2022 at 05:02:22PM +0200, Sakari Ailus wrote:
> Hi Andy,
>
> On Tue, Jul 26, 2022 at 03:05:50PM +0300, Andy Shevchenko wrote:
> > Besides not being understandable at the first glance, the code
> > might provoke a compiler or a static analyser tool to warn about
> > out-of-bound access (when len == 0).
>
> I've never seen one.
>
> However the same pattern is repeatedly used by many, many drivers and
> addressing just one doesn't make much sense.
>
> The proper way to fix this would be to have a set of common CCI (Camera
> Control Interface) functions that all drivers could use, and then switch
> the drivers to use them.
>
> This isn't currently a great fit for e.g. regmap but perhaps something
> light on top of regmap-i2c could do the trick?

So, then we can skip this one, right?

> The rest of the set seems good to me.

Thank you for the review, can you apply them, or should I send a v2 with
dropped first patch?

--
With Best Regards,
Andy Shevchenko