riscv64/uart/sifive: If we get an invalid clock, skip setting baud
* Prevents us breaking a potentially working serial uart. Change-Id: I57bed42cfa571d3d961ee07f380c96b62c7f34d6 Reviewed-on: https://review.haiku-os.org/c/haiku/+/8798 Reviewed-by: waddlesplash <[email protected]>
This commit is contained in:
@@ -37,7 +37,13 @@ ArchUARTSifive::Init()
|
||||
void
|
||||
ArchUARTSifive::InitPort(uint32 baud)
|
||||
{
|
||||
uint64 quotient = (Clock() + baud - 1) / baud;
|
||||
int64 clock = Clock();
|
||||
|
||||
// if we get an invalid clock for some reason, just accept the currently set baud.
|
||||
if (clock < 0)
|
||||
return;
|
||||
|
||||
uint64 quotient = (clock + baud - 1) / baud;
|
||||
|
||||
if (quotient == 0)
|
||||
Regs()->div = 0;
|
||||
|
||||
Reference in New Issue
Block a user