Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/arm/cortex Fail gracefully when an attempt to alloc...
details: https://anonhg.NetBSD.org/src/rev/2768954443e4
branches: trunk
changeset: 445496:2768954443e4
user: jmcneill <jmcneill%NetBSD.org@localhost>
date: Tue Oct 30 23:59:47 2018 +0000
description:
Fail gracefully when an attempt to allocate MSI vectors is made on a device
without MSI capabilities.
diffstat:
sys/arch/arm/cortex/gic_v2m.c | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
diffs (30 lines):
diff -r e715d364ab27 -r 2768954443e4 sys/arch/arm/cortex/gic_v2m.c
--- a/sys/arch/arm/cortex/gic_v2m.c Tue Oct 30 22:32:33 2018 +0000
+++ b/sys/arch/arm/cortex/gic_v2m.c Tue Oct 30 23:59:47 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: gic_v2m.c,v 1.1 2018/10/21 00:42:05 jmcneill Exp $ */
+/* $NetBSD: gic_v2m.c,v 1.2 2018/10/30 23:59:47 jmcneill Exp $ */
/*-
* Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
#define _INTR_PRIVATE
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: gic_v2m.c,v 1.1 2018/10/21 00:42:05 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gic_v2m.c,v 1.2 2018/10/30 23:59:47 jmcneill Exp $");
#include <sys/param.h>
#include <sys/kmem.h>
@@ -141,7 +141,10 @@
{
struct gic_v2m_frame * const frame = msi->msi_priv;
pci_intr_handle_t *vectors;
- int n;
+ int n, off;
+
+ if (!pci_get_capability(pa->pa_pc, pa->pa_tag, PCI_CAP_MSI, &off, NULL))
+ return NULL;
const int avail = gic_v2m_msi_available_spi(frame);
if (exact && *count > avail)
Home |
Main Index |
Thread Index |
Old Index