Thread (83 messages) flat view 83 messages, 6 authors, 2018-03-27

Re: [PATCH 01/21] powerpc: Remove warning on array size when empty

From: Mathieu Malaterre <hidden>
Date: 2018-02-27 07:25:37
Also in: lkml

On Mon, Feb 26, 2018 at 3:45 PM, Andy Shevchenko
[off-list ref] wrote:
On Mon, Feb 26, 2018 at 4:44 PM, Andy Shevchenko
[off-list ref] wrote:
quoted
On Sun, Feb 25, 2018 at 7:22 PM, Mathieu Malaterre [off-list ref] wrote:
quoted
quoted
 static void __init check_cpu_feature_properties(unsigned long node)
 {
-       unsigned long i;
        struct feature_property *fp = feature_properties;
        const __be32 *prop;
Much simpler is just add

if (ARRAY_SIZE() == 0)
 return;
quoted
-       for (i = 0; i < ARRAY_SIZE(feature_properties); ++i, ++fp) {
+       for (; fp != feature_properties + ARRAY_SIZE(feature_properties); ++fp) {
...or convert to while(), which will be more readable.
So you'd prefer something like:

while (fp < feature_properties + ARRAY_SIZE(feature_properties)) {
  ...
  ++fp;
}

right ?
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help