Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/arm/pci Properly honour max_type arg to pci_intr_alloc



details:   https://anonhg.NetBSD.org/src/rev/2b585e397148
branches:  trunk
changeset: 964477:2b585e397148
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Sat Aug 03 12:55:46 2019 +0000

description:
Properly honour max_type arg to pci_intr_alloc

diffstat:

 sys/arch/arm/pci/pci_msi_machdep.c |  11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diffs (41 lines):

diff -r e743124db6ad -r 2b585e397148 sys/arch/arm/pci/pci_msi_machdep.c
--- a/sys/arch/arm/pci/pci_msi_machdep.c        Sat Aug 03 12:09:22 2019 +0000
+++ b/sys/arch/arm/pci/pci_msi_machdep.c        Sat Aug 03 12:55:46 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pci_msi_machdep.c,v 1.6 2019/07/25 00:42:43 jmcneill Exp $ */
+/* $NetBSD: pci_msi_machdep.c,v 1.7 2019/08/03 12:55:46 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pci_msi_machdep.c,v 1.6 2019/07/25 00:42:43 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_msi_machdep.c,v 1.7 2019/08/03 12:55:46 jmcneill Exp $");
 
 #include <sys/kernel.h>
 #include <sys/kmem.h>
@@ -186,11 +186,10 @@
        int intx_count, msi_count, msix_count, error;
 
        error = EINVAL;
-       intx_count = 1;
-       msi_count = 1;
-       msix_count = 1;
 
        if (counts != NULL) {
+               intx_count = msi_count = msix_count = 0;
+
                switch (max_type) {
                case PCI_INTR_TYPE_MSIX:
                        msix_count = counts[PCI_INTR_TYPE_MSIX];
@@ -207,6 +206,8 @@
                        return EINVAL;
                }
                memset(counts, 0, sizeof(*counts) * PCI_INTR_TYPE_SIZE);
+       } else {
+               intx_count = msi_count = msix_count = 1;
        }
 
        if (msix_count == -1)



Home | Main Index | Thread Index | Old Index