Module Name: src
Committed By: jdc
Date: Sat Dec 5 14:50:33 UTC 2020
Modified Files:
src/sys/dev/i2c: hytp14.c si70xx.c
Log Message:
Make sure that we set sc->sc_sme to NULL in failure cases in order to avoid
calling sysmon_envsys_unregister() with an invalid struct when we detach.
To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/i2c/hytp14.c
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/i2c/si70xx.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/i2c/hytp14.c
diff -u src/sys/dev/i2c/hytp14.c:1.9 src/sys/dev/i2c/hytp14.c:1.10
--- src/sys/dev/i2c/hytp14.c:1.9 Tue Oct 8 21:16:11 2019
+++ src/sys/dev/i2c/hytp14.c Sat Dec 5 14:50:33 2020
@@ -61,7 +61,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: hytp14.c,v 1.9 2019/10/08 21:16:11 kardel Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hytp14.c,v 1.10 2020/12/05 14:50:33 jdc Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -189,6 +189,7 @@ hytp14_attach(device_t parent, device_t
aprint_error_dev(sc->sc_dev,
"unable to attach sensor\n");
sysmon_envsys_destroy(sc->sc_sme);
+ sc->sc_sme = NULL;
return;
}
}
Index: src/sys/dev/i2c/si70xx.c
diff -u src/sys/dev/i2c/si70xx.c:1.5 src/sys/dev/i2c/si70xx.c:1.6
--- src/sys/dev/i2c/si70xx.c:1.5 Sun Feb 3 12:18:21 2019
+++ src/sys/dev/i2c/si70xx.c Sat Dec 5 14:50:33 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: si70xx.c,v 1.5 2019/02/03 12:18:21 mrg Exp $ */
+/* $NetBSD: si70xx.c,v 1.6 2020/12/05 14:50:33 jdc Exp $ */
/*
* Copyright (c) 2017 Brad Spencer <[email protected]>
@@ -17,7 +17,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: si70xx.c,v 1.5 2019/02/03 12:18:21 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: si70xx.c,v 1.6 2020/12/05 14:50:33 jdc Exp $");
/*
Driver for the Silicon Labs SI7013/SI7020/SI7021
@@ -718,6 +718,7 @@ si70xx_attach(device_t parent, device_t
if (error) {
aprint_error_dev(self,
"Unable to attach sensor %d: %d\n", i, error);
+ sc->sc_sme = NULL;
goto out;
}
}