Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/ic Prevent multiple unregistrations.



details:   https://anonhg.NetBSD.org/src/rev/81e60b766f2e
branches:  trunk
changeset: 368752:81e60b766f2e
user:      mlelstv <mlelstv%NetBSD.org@localhost>
date:      Mon Aug 01 14:44:15 2022 +0000

description:
Prevent multiple unregistrations.

diffstat:

 sys/dev/ic/nslm7x.c |  10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diffs (45 lines):

diff -r 7eb97e668077 -r 81e60b766f2e sys/dev/ic/nslm7x.c
--- a/sys/dev/ic/nslm7x.c       Mon Aug 01 14:43:15 2022 +0000
+++ b/sys/dev/ic/nslm7x.c       Mon Aug 01 14:44:15 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nslm7x.c,v 1.76 2022/08/01 14:43:15 mlelstv Exp $ */
+/*     $NetBSD: nslm7x.c,v 1.77 2022/08/01 14:44:15 mlelstv Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nslm7x.c,v 1.76 2022/08/01 14:43:15 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nslm7x.c,v 1.77 2022/08/01 14:44:15 mlelstv Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -2247,6 +2247,7 @@
                if ((rv = sysmon_envsys_sensor_attach(lmsc->sc_sme,
                            &lmsc->sensors[i])) != 0) {
                        sysmon_envsys_destroy(lmsc->sc_sme);
+                       lmsc->sc_sme = NULL;
                        aprint_error_dev(lmsc->sc_dev,
                            "sysmon_envsys_sensor_attach() returned %d\n", rv);
                        return;
@@ -2270,6 +2271,7 @@
                aprint_error_dev(lmsc->sc_dev,
                    "unable to register with sysmon\n");
                sysmon_envsys_destroy(lmsc->sc_sme);
+               lmsc->sc_sme = NULL;
        }
        if (!pmf_device_register(lmsc->sc_dev, NULL, NULL))
                aprint_error_dev(lmsc->sc_dev,
@@ -2285,7 +2287,9 @@
 {
        callout_halt(&lmsc->sc_callout, NULL);
        callout_destroy(&lmsc->sc_callout);
-       sysmon_envsys_unregister(lmsc->sc_sme);
+
+       if (lmsc->sc_sme != NULL)
+               sysmon_envsys_unregister(lmsc->sc_sme);
        pmf_device_deregister(lmsc->sc_dev);
 }
 



Home | Main Index | Thread Index | Old Index