Commit 17945d31 authored by Jiri Slaby's avatar Jiri Slaby Committed by Greg Kroah-Hartman

tty/vt: consolemap: use ARRAY_SIZE()

The code uses constants as bounds in loops. Use ARRAY_SIZE() with
appropriate parameters instead. This makes the loop bounds obvious.
Reviewed-by: default avatarIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
Link: https://lore.kernel.org/r/20220607104946.18710-1-jslaby@suse.czSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 5c4d7b04
......@@ -408,7 +408,7 @@ static void con_release_unimap(struct uni_pagedir *p)
}
p->uni_pgdir[i] = NULL;
}
for (i = 0; i < 4; i++) {
for (i = 0; i < ARRAY_SIZE(p->inverse_translations); i++) {
kfree(p->inverse_translations[i]);
p->inverse_translations[i] = NULL;
}
......@@ -798,7 +798,7 @@ u32 conv_8bit_to_uni(unsigned char c)
int conv_uni_to_8bit(u32 uni)
{
int c;
for (c = 0; c < 0x100; c++)
for (c = 0; c < ARRAY_SIZE(translations[USER_MAP]); c++)
if (translations[USER_MAP][c] == uni ||
(translations[USER_MAP][c] == (c | 0xf000) && uni == c))
return c;
......
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