Commit bcf1eed3 authored by Ard Biesheuvel's avatar Ard Biesheuvel Committed by Will Deacon

arm64: idreg-override: avoid strlen() to check for empty strings

strlen() is a costly way to decide whether a string is empty, as in that
case, the first character will be NUL so we can check for that directly.
Signed-off-by: default avatarArd Biesheuvel <ardb@kernel.org>
Link: https://lore.kernel.org/r/20231129111555.3594833-60-ardb@google.comSigned-off-by: default avatarWill Deacon <will@kernel.org>
parent dc3f5aae
......@@ -232,7 +232,7 @@ static void __init match_options(const char *cmdline)
override = prel64_pointer(reg->override);
for (f = 0; strlen(reg->fields[f].name); f++) {
for (f = 0; reg->fields[f].name[0] != '\0'; f++) {
u64 shift = reg->fields[f].shift;
u64 width = reg->fields[f].width ?: 4;
u64 mask = GENMASK_ULL(shift + width - 1, shift);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment