handle cd1400_compute_baud() failure and avoid reading uninitialised
variables.
This commit is contained in:
parent
b29a286b3b
commit
8c3580ff36
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: magma.c,v 1.61 2019/11/10 21:16:37 chs Exp $ */
|
||||
/* $NetBSD: magma.c,v 1.62 2021/04/12 09:23:32 mrg Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998 Iain Hibbert
|
||||
|
@ -31,7 +31,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: magma.c,v 1.61 2019/11/10 21:16:37 chs Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: magma.c,v 1.62 2021/04/12 09:23:32 mrg Exp $");
|
||||
|
||||
#if 0
|
||||
#define MAGMA_DEBUG
|
||||
|
@ -1743,7 +1743,10 @@ mbpp_recv(struct mbpp_port *mp, void *ptr, int len)
|
|||
cd1400_write_reg(cd, CD1400_CAR, 0);
|
||||
|
||||
/* input strobe at 100kbaud (10microseconds) */
|
||||
cd1400_compute_baud(100000, cd->cd_clock, &rcor, &rbpr);
|
||||
if (cd1400_compute_baud(100000, cd->cd_clock, &rcor, &rbpr)) {
|
||||
splx(s);
|
||||
return 0;
|
||||
}
|
||||
cd1400_write_reg(cd, CD1400_RCOR, rcor);
|
||||
cd1400_write_reg(cd, CD1400_RBPR, rbpr);
|
||||
|
||||
|
|
Loading…
Reference in New Issue