Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/ic Do not create the sysctl tree if the initial setu...



details:   https://anonhg.NetBSD.org/src/rev/bb5f302272df
branches:  trunk
changeset: 374276:bb5f302272df
user:      brad <brad%NetBSD.org@localhost>
date:      Sun Apr 16 17:16:45 2023 +0000

description:
Do not create the sysctl tree if the initial setup of the chip fails.

diffstat:

 sys/dev/ic/bmx280.c |  14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diffs (42 lines):

diff -r 0315d6d27244 -r bb5f302272df sys/dev/ic/bmx280.c
--- a/sys/dev/ic/bmx280.c       Sun Apr 16 16:55:01 2023 +0000
+++ b/sys/dev/ic/bmx280.c       Sun Apr 16 17:16:45 2023 +0000
@@ -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 <brad%anduin.eldar.org@localhost>
@@ -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) {



Home | Main Index | Thread Index | Old Index