From: John Ogness <john.ogness@linutronix.de>
Date: Fri, 24 Feb 2023 15:23:51 +0000
Subject: [PATCH 01/24] kdb: do not assume write() callback available

It is allowed for consoles to provide no write() callback. For
example ttynull does this.

Check if a write() callback is available before using it.

Signed-off-by: John Ogness <john.ogness@linutronix.de>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
 kernel/debug/kdb/kdb_io.c |    2 ++
 1 file changed, 2 insertions(+)

Index: linux-6.3.0-rt11/kernel/debug/kdb/kdb_io.c
===================================================================
@ linux-6.3.0-rt11/kernel/debug/kdb/kdb_io.c:579 @ static void kdb_msg_write(const char *ms
 			continue;
 		if (c == dbg_io_ops->cons)
 			continue;
+		if (!c->write)
+			continue;
 		/*
 		 * Set oops_in_progress to encourage the console drivers to
 		 * disregard their internal spin locks: in the current calling