Using uninitialized_var() is dangerous as it papers over real bugs[1] (or can in the future), and suppresses unrelated compiler warnings (e.g. "unused variable"). If the compiler thinks it is uninitialized, either simply initialize the variable or make compiler changes. As a precursor to removing[2] this[3] macro[4], refactor code to avoid its need. The original reason for its use here was to work around the #ifdef being the only place the variable was used. This is better expressed using IS_ENABLED() and a new code block where the variable can be used unconditionally. [1] https://lore.kernel.org/lkml/20200603174714.192027-1-glider@google.com/ [2] https://lore.kernel.org/lkml/CA+55aFw+Vbj0i=1TGqCR5vQkCzWJ0QxK6CernOU6eedsudAixw@mail.gmail.com/ [3] https://lore.kernel.org/lkml/CA+55aFwgbgqhbp1fkxvRKEpzyR5J8n1vKT1VZdz9knmPuXhOeg@mail.gmail.com/ [4] https://lore.kernel.org/lkml/CA+55aFz2500WfbKXAx8s67wrm9=yVJu65TpLgN_ybYNv0VEOKA@mail.gmail.com/
Showing the changes to include/linux (1 of 2 files). Show all
Unified · Split
| @@ -98,9 +98,11 @@ · 97 unmodified lines | ||
| 98 | 98 | /* |
| 99 | 99 | * We are going to use the flags for the page to node mapping if its in |
| 100 | 100 | * there. This includes the case where there is no node, so it is implicit. |
| 101 | + * Note that this #define MUST have a value so that it can be tested with | |
| 102 | + * the IS_ENABLED() macro. | |
| 101 | 103 | */ |
| 102 | 104 | #if !(NODES_WIDTH > 0 || NODES_SHIFT == 0) |
| 103 | −#define NODE_NOT_IN_PAGE_FLAGS | |
| 105 | +#define NODE_NOT_IN_PAGE_FLAGS 1 | |
| 104 | 106 | #endif |
| 105 | 107 | |
| 106 | 108 | #if defined(CONFIG_NUMA_BALANCING) && LAST_CPUPID_WIDTH == 0 |