summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authormlelstv <mlelstv@NetBSD.org>2021-06-13 10:05:39 +0000
committermlelstv <mlelstv@NetBSD.org>2021-06-13 10:05:39 +0000
commitaa6f956ba3a4ef17147e91bec556690bc2c7ac5f (patch)
treed097d02ff32dc3f81971345423c9bdba4d447f39 /sys/dev
parent4ce707852c521854a196ad7c1bd9d395380557d5 (diff)
Don't ignore errors of sysmon_envsys_register().
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/pci/if_aq.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/sys/dev/pci/if_aq.c b/sys/dev/pci/if_aq.c
index 3ad8dbde8aa..c1239572e63 100644
--- a/sys/dev/pci/if_aq.c
+++ b/sys/dev/pci/if_aq.c
@@ -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, void *aux)
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 __unused)
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