git: 800c4034d201 - stable/14 - kern: ofw: provide ofw_bus_destroy_iinfo to teardown interrupt-map

From: Kyle Evans <kevans_at_FreeBSD.org>
Date: Wed, 10 Jun 2026 04:01:08 UTC
The branch stable/14 has been updated by kevans:

URL: https://cgit.FreeBSD.org/src/commit/?id=800c4034d201034345be462de6f2f9178971fd92

commit 800c4034d201034345be462de6f2f9178971fd92
Author:     Kyle Evans <kevans@FreeBSD.org>
AuthorDate: 2026-05-09 02:42:50 +0000
Commit:     Kyle Evans <kevans@FreeBSD.org>
CommitDate: 2026-06-10 04:00:48 +0000

    kern: ofw: provide ofw_bus_destroy_iinfo to teardown interrupt-map
    
    For symmetry with ofw_bus_setup_iinfo, the next commits will use it to
    properly cleanup on failure in bcm2838_pci.
    
    Reviewed by:    andrew
    
    (cherry picked from commit b230a7b9a52c0fc948f4f1dcd1225a94674073f6)
---
 sys/dev/ofw/ofw_bus_subr.c | 12 ++++++++++++
 sys/dev/ofw/ofw_bus_subr.h |  1 +
 2 files changed, 13 insertions(+)

diff --git a/sys/dev/ofw/ofw_bus_subr.c b/sys/dev/ofw/ofw_bus_subr.c
index a21c5fa2735b..adc5ccdf1869 100644
--- a/sys/dev/ofw/ofw_bus_subr.c
+++ b/sys/dev/ofw/ofw_bus_subr.c
@@ -349,6 +349,18 @@ ofw_bus_setup_iinfo(phandle_t node, struct ofw_bus_iinfo *ii, int intrsz)
 	}
 }
 
+void
+ofw_bus_destroy_iinfo(struct ofw_bus_iinfo *ii)
+{
+
+	if (ii->opi_imapsz > 0) {
+		OF_prop_free(ii->opi_imapmsk);
+		ii->opi_imapsz = 0;
+	}
+
+	OF_prop_free(ii->opi_imap);
+}
+
 int
 ofw_bus_lookup_imap(phandle_t node, struct ofw_bus_iinfo *ii, void *reg,
     int regsz, void *pintr, int pintrsz, void *mintr, int mintrsz,
diff --git a/sys/dev/ofw/ofw_bus_subr.h b/sys/dev/ofw/ofw_bus_subr.h
index 1a33d7655f77..2e13f29a67f6 100644
--- a/sys/dev/ofw/ofw_bus_subr.h
+++ b/sys/dev/ofw/ofw_bus_subr.h
@@ -86,6 +86,7 @@ bus_get_device_path_t	ofw_bus_gen_get_device_path;
 
 /* Routines for processing firmware interrupt maps */
 void	ofw_bus_setup_iinfo(phandle_t, struct ofw_bus_iinfo *, int);
+void	ofw_bus_destroy_iinfo(struct ofw_bus_iinfo *);
 int	ofw_bus_lookup_imap(phandle_t, struct ofw_bus_iinfo *, void *, int,
 	    void *, int, void *, int, phandle_t *);
 int	ofw_bus_search_intrmap(void *, int, void *, int, void *, int, void *,