Re: [PATCH v3] checks: tigthen up nr-gpios prop exception

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

On Wed, Apr 7, 2021 at 7:59 PM David Gibson <david@xxxxxxxxxxxxxxxxxxxxx> wrote:
> On Mon, Apr 05, 2021 at 04:28:55PM -0700, Ilya Lipnitskiy wrote:
> > There are no instances of nr-gpio in the Linux kernel tree, only
> > "[<vendor>,]nr-gpios", so make the check stricter.
> >
> > nr-gpios without a "vendor," prefix is also invalid, according to the DT
> > spec[0], and there are no DT files in the Linux kernel tree with
> > non-vendor nr-gpios. There are some drivers, but they are not DT spec
> > compliant, so don't suppress the check for them.
> >
> > [0]:
> > Link:
> >
> > Signed-off-by: Ilya Lipnitskiy <ilya.lipnitskiy@xxxxxxxxx>
> > Cc: Rob Herring <robh+dt@xxxxxxxxxx>
> Applied, since it looks like it definitely improves the current
> situation.
> The use of strstr() at all seems kind of bogus to me.  Shouldn't we
> explicitly be checking that ",nr-gpios" forms the *end* of the
> property name?
Yeah, I noticed that too. We could replace strstr with something
similar to strcmp_suffix in drivers/of/property.c:

static int strcmp_suffix(const char *str, const char *suffix)
        unsigned int len, suffix_len;

        len = strlen(str);
        suffix_len = strlen(suffix);
        if (len <= suffix_len)
                return -1;
        return strcmp(str + len - suffix_len, suffix);


[Index of Archives]     [Device Tree]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux