(tiny) patch review: return if RTC diag fails

Emile `iMil' Heitor <[email protected]>
Newsgroups gmane.os.netbsd.devel.kernel
Message-ID <[email protected]>
Currently in sys/arch/x86/isa/clock.c startrtclock(), the function
continues to call tc_init() even when mc146818_read(NULL, NVRAM_DIAG)
fails. This causes the system to hang on qemu/microvm when rtc=on is
not specified.

My proposal is to return if RTC BIOS diagnostic fails:

ef4df237b7db39630f5400b6f0f193eebe1afe87 Return if RTC BIOS fails
diff --git a/sys/arch/x86/isa/clock.c b/sys/arch/x86/isa/clock.c
index 8305818c109..4c9445227f4 100644
--- a/sys/arch/x86/isa/clock.c
+++ b/sys/arch/x86/isa/clock.c
@@ -335,6 +335,7 @@ startrtclock(void)
  		char bits[128];
  		snprintb(bits, sizeof(bits), NVRAM_DIAG_BITS, s);
  		printf("RTC BIOS diagnostic error %s\n", bits);
+		return;
  	}

  	tc_init(&i8254_timecounter);

Thoughts?

------------------------------------------------------------------------
Emile `iMil' Heitor <imil@{home.imil.net,NetBSD.org}> | https://imil.net
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.