RE: [PATCH v2 2/7] platform/x86/intel/ifs: Introduce Array Scan test to IFS

From: Luck, Tony
Date: Thu Feb 16 2023 - 13:46:11 EST


>> +enum test_types {
>> + IFS_SAF,
>> + IFS_ARRAY,
>
> As you are using this enum to index an array, don't you need to set the
> starting value to be sure it's 0?

C standard says: "The value of the first enumerator (if it does not use = constant-expression) is zero."

>> +#define IFS_NUMTESTS ARRAY_SIZE(ifs_devices)
>
> Don't do this, just have a list with a NULL entry at the end, makes
> things much simpler and easier over time.

Maintainers seem to be divided over this. Personally, I'm also
in favor of a NULL entry to mark the last entry (I think it was one
of Kernighan and Plauger's style guides "End markers are better
than counts"). But the tiny footprint folks have beaten me up in
the past for wasting a whole extra structure element just to include
a terminator. :-(

-Tony