Commit 0b8d9fc9 authored by Ard Biesheuvel's avatar Ard Biesheuvel

efi/libstub: Make efi_printk() input argument const char*

To help the compiler figure out that efi_printk() will not modify
the string it is given, make the input argument type const char*.

While at it, simplify the implementation as well.
Suggested-by: default avatarJoe Perches <joe@perches.com>
Signed-off-by: default avatarArd Biesheuvel <ardb@kernel.org>
parent f77767ed
...@@ -26,20 +26,15 @@ bool __pure __efi_soft_reserve_enabled(void) ...@@ -26,20 +26,15 @@ bool __pure __efi_soft_reserve_enabled(void)
return !efi_nosoftreserve; return !efi_nosoftreserve;
} }
void efi_printk(char *str) void efi_printk(const char *str)
{ {
char *s8; while (*str) {
efi_char16_t ch[] = { *str++, L'\0' };
for (s8 = str; *s8; s8++) {
efi_char16_t ch[2] = { 0 };
ch[0] = *s8;
if (*s8 == '\n') {
efi_char16_t nl[2] = { '\r', 0 };
efi_char16_printk(nl);
}
efi_char16_printk(ch); if (ch[0] == L'\n')
efi_char16_printk(L"\r\n");
else
efi_char16_printk(ch);
} }
} }
......
...@@ -625,7 +625,7 @@ efi_status_t check_platform_features(void); ...@@ -625,7 +625,7 @@ efi_status_t check_platform_features(void);
void *get_efi_config_table(efi_guid_t guid); void *get_efi_config_table(efi_guid_t guid);
void efi_printk(char *str); void efi_printk(const char *str);
void efi_free(unsigned long size, unsigned long addr); void efi_free(unsigned long size, unsigned long addr);
......
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