Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/pci Only unregister the sensors if these were succes...



details:   https://anonhg.NetBSD.org/src/rev/9ac21e22d811
branches:  trunk
changeset: 753613:9ac21e22d811
user:      jruoho <jruoho%NetBSD.org@localhost>
date:      Sat Apr 03 17:54:24 2010 +0000

description:
Only unregister the sensors if these were successfully installed;
sysmon_envsys_unregister() does not check for NULL pointers gracefully.

diffstat:

 sys/dev/pci/arcmsr.c |  14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)

diffs (43 lines):

diff -r 15a5d1538e55 -r 9ac21e22d811 sys/dev/pci/arcmsr.c
--- a/sys/dev/pci/arcmsr.c      Sat Apr 03 17:20:05 2010 +0000
+++ b/sys/dev/pci/arcmsr.c      Sat Apr 03 17:54:24 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: arcmsr.c,v 1.24 2010/04/03 14:19:17 pgoyette Exp $ */
+/*     $NetBSD: arcmsr.c,v 1.25 2010/04/03 17:54:24 jruoho Exp $ */
 /*     $OpenBSD: arc.c,v 1.68 2007/10/27 03:28:27 dlg Exp $ */
 
 /*
@@ -21,7 +21,7 @@
 #include "bio.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: arcmsr.c,v 1.24 2010/04/03 14:19:17 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: arcmsr.c,v 1.25 2010/04/03 17:54:24 jruoho Exp $");
 
 #include <sys/param.h>
 #include <sys/buf.h>
@@ -238,7 +238,9 @@
        if (arc_msg0(sc, ARC_REG_INB_MSG0_FLUSH_CACHE) != 0)
                aprint_error_dev(self, "timeout waiting to flush cache\n");
 
-       sysmon_envsys_unregister(sc->sc_sme);
+       if (sc->sc_sme != NULL)
+               sysmon_envsys_unregister(sc->sc_sme);
+
        return 0;
 }
 
@@ -1805,8 +1807,12 @@
        kthread_exit(0);
 
 bad:
+       sysmon_envsys_destroy(sc->sc_sme);
        kmem_free(sc->sc_sensors, slen);
-       sysmon_envsys_destroy(sc->sc_sme);
+
+       sc->sc_sme = NULL;
+       sc->sc_sensors = NULL;
+
        kthread_exit(0);
 }
 



Home | Main Index | Thread Index | Old Index