Re: [PATCH 4/5] staging: sm750fb: use ARRAY_SIZE macro in fb_find_mode loop

From: David Laight

Date: Sat May 23 2026 - 12:30:15 EST


On Sat, 23 May 2026 13:07:49 +0300
Dan Carpenter <error27@xxxxxxxxx> wrote:

> On Sat, May 23, 2026 at 05:15:08AM +0000, Ahmet Sezgin Duran wrote:
> > The loop in lynxfb_set_fbinfo() iterates over pdb[] and cdb[] using
> > a hardcoded bound of 3.
> >
> > Replace it with ARRAY_SIZE(pdb) so the bound tracks the array.
>
> I don't love this. As you mentioned, there are two arrays and they
> both have 3 elements. Why prefer one over the other? This patch
> makes the code look simpler than it really is. I would just leave
> it as 3.

Or change the code to have one array of a struct that contains the ptr:count
pair and iterate over that.
Both pdb[] and cdb[] (or what replaces them) should (probably) be static.

This interface is strange, the NULL:0 requests the modes from xfree86
(which aren't visible) whereas the vesa modes that are defined just
after them have to be requested by ptr:count,

-- David


>
> regards,
> dan carpenter
>
>