serial: earlycon: bail out on zero progress in SBI DBCN write

sbi_dbcn_console_write() loops until all bytes are written and exits
early only on an error. When sbi_debug_console_write() returns 0 it
stays in the loop forever.

A zero return is not an error. Per the SBI specification, the call "may
do partial/no writes if the debug console is not able to accept more
bytes".

OpenSBI can return 0 here. Its semihosting console reports 0 when a host
write fails, and SBI passes that number back unchanged.

Fix the check to use <= instead of <, so that a zero return also ends
the loop.

Fixes: c77bf3607a0f ("tty/serial: Add RISC-V SBI debug console based earlycon")
Cc: stable@vger.kernel.org
Signed-off-by: liutong <liutong@iscas.ac.cn>
Link: https://patch.msgid.link/20261123094843.540808-1-liutong@iscas.ac.cn
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
diff --git a/drivers/tty/serial/earlycon-riscv-sbi.c b/drivers/tty/serial/earlycon-riscv-sbi.c
index 0162155..a8ffee3 100644
--- a/drivers/tty/serial/earlycon-riscv-sbi.c
+++ b/drivers/tty/serial/earlycon-riscv-sbi.c
@@ -29,7 +29,7 @@ static void sbi_dbcn_console_write(struct console *con,
 
 	while (n) {
 		ret = sbi_debug_console_write(s, n);
-		if (ret < 0)
+		if (ret <= 0)
 			break;
 
 		s += ret;