Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/acpi MD code may allocate a new dma tag for attach a...



details:   https://anonhg.NetBSD.org/src/rev/90ca6d15f535
branches:  trunk
changeset: 967988:90ca6d15f535
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Mon Dec 30 19:49:38 2019 +0000

description:
MD code may allocate a new dma tag for attach args, so destroy it if the device node is not claimed

diffstat:

 sys/dev/acpi/acpi.c |  18 ++++++++++++++++--
 1 files changed, 16 insertions(+), 2 deletions(-)

diffs (46 lines):

diff -r cd5cfaada345 -r 90ca6d15f535 sys/dev/acpi/acpi.c
--- a/sys/dev/acpi/acpi.c       Mon Dec 30 18:53:54 2019 +0000
+++ b/sys/dev/acpi/acpi.c       Mon Dec 30 19:49:38 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: acpi.c,v 1.279 2019/12/29 23:47:56 jmcneill Exp $      */
+/*     $NetBSD: acpi.c,v 1.280 2019/12/30 19:49:38 jmcneill Exp $      */
 
 /*-
  * Copyright (c) 2003, 2007 The NetBSD Foundation, Inc.
@@ -100,7 +100,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi.c,v 1.279 2019/12/29 23:47:56 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi.c,v 1.280 2019/12/30 19:49:38 jmcneill Exp $");
 
 #include "pci.h"
 #include "opt_acpi.h"
@@ -899,6 +899,13 @@
 
                ad->ad_device = config_found_ia(sc->sc_dev,
                    "acpinodebus", &aa, acpi_print);
+
+               if (ad->ad_device == NULL) {
+                       if (aa.aa_dmat != NULL)
+                               bus_dmatag_destroy(aa.aa_dmat);
+                       if (aa.aa_dmat64 != NULL)
+                               bus_dmatag_destroy(aa.aa_dmat64);
+               }
        }
 }
 
@@ -961,6 +968,13 @@
 
                ad->ad_device = config_found_ia(sc->sc_dev,
                    "acpinodebus", &aa, acpi_print);
+
+               if (ad->ad_device == NULL) {
+                       if (aa.aa_dmat != NULL)
+                               bus_dmatag_destroy(aa.aa_dmat);
+                       if (aa.aa_dmat64 != NULL)
+                               bus_dmatag_destroy(aa.aa_dmat64);
+               }
        }
 }
 



Home | Main Index | Thread Index | Old Index