Module Name: src
Committed By: riastradh
Date: Tue Apr 19 01:35:28 UTC 2022
Modified Files:
src/sys/dev/usb: umcs.c
Log Message:
umcs(4): Avoid using uninitialized data if register read fails.
Reported-by: [email protected]
To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/dev/usb/umcs.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/dev/usb/umcs.c
diff -u src/sys/dev/usb/umcs.c:1.18 src/sys/dev/usb/umcs.c:1.19
--- src/sys/dev/usb/umcs.c:1.18 Wed Feb 9 07:32:33 2022
+++ src/sys/dev/usb/umcs.c Tue Apr 19 01:35:28 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: umcs.c,v 1.18 2022/02/09 07:32:33 mrg Exp $ */
+/* $NetBSD: umcs.c,v 1.19 2022/04/19 01:35:28 riastradh Exp $ */
/* $FreeBSD: head/sys/dev/usb/serial/umcs.c 260559 2014-01-12 11:44:28Z hselasky $ */
/*-
@@ -41,7 +41,7 @@
*
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: umcs.c,v 1.18 2022/02/09 07:32:33 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: umcs.c,v 1.19 2022/04/19 01:35:28 riastradh Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -226,8 +226,8 @@ umcs7840_attach(device_t parent, device_
*
* Also, see notes in header file for these constants.
*/
- umcs7840_get_reg(sc, MCS7840_DEV_REG_GPIO, &data);
- if (data & MCS7840_DEV_GPIO_4PORTS) {
+ error = umcs7840_get_reg(sc, MCS7840_DEV_REG_GPIO, &data);
+ if (error == 0 && (data & MCS7840_DEV_GPIO_4PORTS) != 0) {
sc->sc_numports = 4;
/* physical port no are : 0, 1, 2, 3 */
} else {