Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/pci Don't ignore errors of sysmon_envsys_register().



details:   https://anonhg.NetBSD.org/src/rev/97496e721904
branches:  trunk
changeset: 1021688:97496e721904
user:      mlelstv <mlelstv%NetBSD.org@localhost>
date:      Sun Jun 13 10:05:39 2021 +0000

description:
Don't ignore errors of sysmon_envsys_register().

diffstat:

 sys/dev/pci/if_aq.c |  11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

diffs (39 lines):

diff -r 266f9932d563 -r 97496e721904 sys/dev/pci/if_aq.c
--- a/sys/dev/pci/if_aq.c       Sun Jun 13 10:04:10 2021 +0000
+++ b/sys/dev/pci/if_aq.c       Sun Jun 13 10:05:39 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_aq.c,v 1.25 2021/04/16 08:09:40 ryo Exp $   */
+/*     $NetBSD: if_aq.c,v 1.26 2021/06/13 10:05:39 mlelstv Exp $       */
 
 /**
  * aQuantia Corporation Network Driver
@@ -62,7 +62,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_aq.c,v 1.25 2021/04/16 08:09:40 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_aq.c,v 1.26 2021/06/13 10:05:39 mlelstv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_if_aq.h"
@@ -1491,7 +1491,11 @@
                snprintf(sc->sc_sensor_temp.desc, ENVSYS_DESCLEN, "PHY");
 
                sysmon_envsys_sensor_attach(sc->sc_sme, &sc->sc_sensor_temp);
-               sysmon_envsys_register(sc->sc_sme);
+               if (sysmon_envsys_register(sc->sc_sme)) {
+                       sysmon_envsys_destroy(sc->sc_sme);
+                       sc->sc_sme = NULL;
+                       goto attach_failure;
+               }
 
                /*
                 * for unknown reasons, the first call of fw2x_get_temperature()
@@ -1579,7 +1583,6 @@
        if (sc->sc_sme != NULL) {
                /* all sensors associated with this will also be detached */
                sysmon_envsys_unregister(sc->sc_sme);
-               sc->sc_sme = NULL;
        }
 #endif
 



Home | Main Index | Thread Index | Old Index