Module Name: src
Committed By: brad
Date: Sun Apr 16 17:16:45 UTC 2023
Modified Files:
src/sys/dev/ic: bmx280.c
Log Message:
Do not create the sysctl tree if the initial setup of the chip fails.
To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/ic/bmx280.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/ic/bmx280.c
diff -u src/sys/dev/ic/bmx280.c:1.1 src/sys/dev/ic/bmx280.c:1.2
--- src/sys/dev/ic/bmx280.c:1.1 Sat Dec 3 01:04:43 2022
+++ src/sys/dev/ic/bmx280.c Sun Apr 16 17:16:45 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: bmx280.c,v 1.1 2022/12/03 01:04:43 brad Exp $ */
+/* $NetBSD: bmx280.c,v 1.2 2023/04/16 17:16:45 brad Exp $ */
/*
* Copyright (c) 2022 Brad Spencer <[email protected]>
@@ -17,7 +17,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bmx280.c,v 1.1 2022/12/03 01:04:43 brad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bmx280.c,v 1.2 2023/04/16 17:16:45 brad Exp $");
/*
* Common driver for the Bosch BMP280/BME280 temperature, humidity (sometimes) and
@@ -444,11 +444,6 @@ bmx280_attach(struct bmx280_sc *sc)
sc->sc_has_humidity = true;
}
- if ((error = bmx280_sysctl_init(sc)) != 0) {
- aprint_error_dev(sc->sc_dev, "Can't setup sysctl tree (%d)\n", error);
- goto out;
- }
-
uint8_t raw_blob_tp[24];
reg = BMX280_REGISTER_DIG_T1;
error = (*(sc->sc_func_read_register))(sc, reg, raw_blob_tp, 24);
@@ -500,6 +495,11 @@ bmx280_attach(struct bmx280_sc *sc)
goto out;
}
+ if ((error = bmx280_sysctl_init(sc)) != 0) {
+ aprint_error_dev(sc->sc_dev, "Can't setup sysctl tree (%d)\n", error);
+ goto out;
+ }
+
for (i = 0; i < sc->sc_numsensors; i++) {
if (sc->sc_has_humidity == false &&
bmx280_sensors[i].type == ENVSYS_SRELHUMIDITY) {