Commit b7a1cd24 authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Ard Biesheuvel

efi/earlycon: Replace open coded strnchrnul()

strnchrnul() can be called in the early stages. Replace
open coded variant in the EFI early console driver.
Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: default avatarArd Biesheuvel <ardb@kernel.org>
parent 1b929c02
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/serial_core.h> #include <linux/serial_core.h>
#include <linux/screen_info.h> #include <linux/screen_info.h>
#include <linux/string.h>
#include <asm/early_ioremap.h> #include <asm/early_ioremap.h>
...@@ -143,16 +144,10 @@ efi_earlycon_write(struct console *con, const char *str, unsigned int num) ...@@ -143,16 +144,10 @@ efi_earlycon_write(struct console *con, const char *str, unsigned int num)
len = si->lfb_linelength; len = si->lfb_linelength;
while (num) { while (num) {
unsigned int linemax; unsigned int linemax = (si->lfb_width - efi_x) / font->width;
unsigned int h, count = 0; unsigned int h, count;
for (s = str; *s && *s != '\n'; s++) { count = strnchrnul(str, num, '\n') - str;
if (count == num)
break;
count++;
}
linemax = (si->lfb_width - efi_x) / font->width;
if (count > linemax) if (count > linemax)
count = linemax; count = linemax;
......
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