Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 13a4db9d authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Ingo Molnar
Browse files

x86/mtrr: Convert to use match_string() helper



The helper returns index of the matching string in an array.
Replace the open coded array lookup with match_string().

Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Luis R. Rodriguez <mcgrof@suse.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Toshi Kani <toshi.kani@hp.com>
Link: http://lkml.kernel.org/r/20180515175759.89315-1-andriy.shevchenko@linux.intel.com


Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
parent 67b8d5c7
Loading
Loading
Loading
Loading
+10 −11
Original line number Diff line number Diff line
@@ -149,9 +149,10 @@ mtrr_write(struct file *file, const char __user *buf, size_t len, loff_t * ppos)
		return -EINVAL;
	ptr = skip_spaces(ptr + 5);

	for (i = 0; i < MTRR_NUM_TYPES; ++i) {
		if (strcmp(ptr, mtrr_strings[i]))
			continue;
	i = match_string(mtrr_strings, MTRR_NUM_TYPES, ptr);
	if (i < 0)
		return i;

	base >>= PAGE_SHIFT;
	size >>= PAGE_SHIFT;
	err = mtrr_add_page((unsigned long)base, (unsigned long)size, i, true);
@@ -159,8 +160,6 @@ mtrr_write(struct file *file, const char __user *buf, size_t len, loff_t * ppos)
		return err;
	return len;
}
	return -EINVAL;
}

static long
mtrr_ioctl(struct file *file, unsigned int cmd, unsigned long __arg)