This change is a bit more than cosmetic. It replaces 2 values in mtrr_strings with NULL. Previously, they were defined as "?", which is not great because you could technically pass "?", and you would get value 2. It's not sure whether that was intended (likely it wasn't), but this fixes that. Signed-off-by: Alexandru Ardelean <alexandru.ardelean@xxxxxxxxxx> --- arch/x86/kernel/cpu/mtrr/if.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/arch/x86/kernel/cpu/mtrr/if.c b/arch/x86/kernel/cpu/mtrr/if.c index 4ec7a5f7b94c..e67820a044cc 100644 --- a/arch/x86/kernel/cpu/mtrr/if.c +++ b/arch/x86/kernel/cpu/mtrr/if.c @@ -20,8 +20,8 @@ static const char *const mtrr_strings[MTRR_NUM_TYPES] = { "uncachable", /* 0 */ "write-combining", /* 1 */ - "?", /* 2 */ - "?", /* 3 */ + NULL, /* 2 */ + NULL, /* 3 */ "write-through", /* 4 */ "write-protect", /* 5 */ "write-back", /* 6 */ @@ -29,7 +29,9 @@ static const char *const mtrr_strings[MTRR_NUM_TYPES] = const char *mtrr_attrib_to_str(int x) { - return (x <= 6) ? mtrr_strings[x] : "?"; + if ((x >= ARRAY_SIZE(mtrr_strings)) || (mtrr_strings[x] == NULL)) + return "?"; + return mtrr_strings[x]; } #ifdef CONFIG_PROC_FS @@ -142,7 +144,7 @@ mtrr_write(struct file *file, const char __user *buf, size_t len, loff_t * ppos) return -EINVAL; ptr = skip_spaces(ptr + 5); - i = __match_string(mtrr_strings, MTRR_NUM_TYPES, ptr); + i = match_string(mtrr_strings, ptr); if (i < 0) return i; -- 2.17.1 _______________________________________________ dri-devel mailing list dri-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/dri-devel