Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/pci Call iic_fini_tag() when the tag is no longer ne...



details:   https://anonhg.NetBSD.org/src/rev/c49076eca357
branches:  trunk
changeset: 364626:c49076eca357
user:      pgoyette <pgoyette%NetBSD.org@localhost>
date:      Fri Apr 01 15:34:34 2022 +0000

description:
Call iic_fini_tag() when the tag is no longer needed.

Without this, a LOCKDEBUG kernel can panic when trying to re-init the tag.

diffstat:

 sys/dev/pci/piixpm.c |  10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diffs (38 lines):

diff -r 8f3af424c0e9 -r c49076eca357 sys/dev/pci/piixpm.c
--- a/sys/dev/pci/piixpm.c      Fri Apr 01 08:26:27 2022 +0000
+++ b/sys/dev/pci/piixpm.c      Fri Apr 01 15:34:34 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: piixpm.c,v 1.66 2021/10/12 08:36:29 andvar Exp $ */
+/* $NetBSD: piixpm.c,v 1.67 2022/04/01 15:34:34 pgoyette Exp $ */
 /*     $OpenBSD: piixpm.c,v 1.39 2013/10/01 20:06:02 sf Exp $  */
 
 /*
@@ -22,7 +22,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: piixpm.c,v 1.66 2021/10/12 08:36:29 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: piixpm.c,v 1.67 2022/04/01 15:34:34 pgoyette Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -352,6 +352,8 @@
                iba.iba_tag = tag;
                sc->sc_i2c_device[i] =
                    config_found(self, &iba, piixpm_iicbus_print, CFARGS_NONE);
+               if (sc->sc_i2c_device[i] == NULL)
+                       iic_tag_fini(tag);
        }
 
        return 0;
@@ -365,6 +367,10 @@
 
        for (i = 0; i < sc->sc_numbusses; i++) {
                if (sc->sc_i2c_device[i] == child) {
+
+                       struct i2c_controller *tag = &sc->sc_i2c_tags[i];
+
+                       iic_tag_fini(tag);
                        sc->sc_i2c_device[i] = NULL;
                        break;
                }



Home | Main Index | Thread Index | Old Index