Module Name: src Committed By: mlelstv Date: Sun Jun 13 10:05:39 UTC 2021
Modified Files: src/sys/dev/pci: if_aq.c Log Message: Don't ignore errors of sysmon_envsys_register(). To generate a diff of this commit: cvs rdiff -u -r1.25 -r1.26 src/sys/dev/pci/if_aq.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/pci/if_aq.c diff -u src/sys/dev/pci/if_aq.c:1.25 src/sys/dev/pci/if_aq.c:1.26 --- src/sys/dev/pci/if_aq.c:1.25 Fri Apr 16 08:09:40 2021 +++ src/sys/dev/pci/if_aq.c Sun Jun 13 10:05:39 2021 @@ -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 @@ aq_attach(device_t parent, device_t self 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 @@ aq_detach(device_t self, int flags __unu 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