Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/pci On error unmap the pci_mapreg_map()d regions usi...
details: https://anonhg.NetBSD.org/src/rev/53b764d590be
branches: trunk
changeset: 958900:53b764d590be
user: reinoud <reinoud%NetBSD.org@localhost>
date: Sun Jan 24 15:33:02 2021 +0000
description:
On error unmap the pci_mapreg_map()d regions using bus_space_unmap() as
suggested by jak@
diffstat:
sys/dev/pci/virtio_pci.c | 12 +++++++++---
1 files changed, 9 insertions(+), 3 deletions(-)
diffs (33 lines):
diff -r 5f601c9bda2a -r 53b764d590be sys/dev/pci/virtio_pci.c
--- a/sys/dev/pci/virtio_pci.c Sun Jan 24 14:51:01 2021 +0000
+++ b/sys/dev/pci/virtio_pci.c Sun Jan 24 15:33:02 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: virtio_pci.c,v 1.22 2021/01/24 14:33:49 reinoud Exp $ */
+/* $NetBSD: virtio_pci.c,v 1.23 2021/01/24 15:33:02 reinoud Exp $ */
/*
* Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -28,7 +28,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: virtio_pci.c,v 1.22 2021/01/24 14:33:49 reinoud Exp $");
+__KERNEL_RCSID(0, "$NetBSD: virtio_pci.c,v 1.23 2021/01/24 15:33:02 reinoud Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -555,7 +555,13 @@
return 0;
err:
- /* there is no pci_mapreg_unmap() */
+ /* undo our pci_mapreg_map()s */
+ for (i = 0; i < __arraycount(bars); i++) {
+ if (bars[i] == 0)
+ continue;
+ bus_space_unmap(psc->sc_bars_iot[j], psc->sc_bars_ioh[j],
+ psc->sc_bars_iosize[j]);
+ }
return ret;
}
Home |
Main Index |
Thread Index |
Old Index