Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/pci pci_resource(9): vmem_create and vmem_add never ...



details:   https://anonhg.NetBSD.org/src/rev/b4babc4be008
branches:  trunk
changeset: 371890:b4babc4be008
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sat Oct 15 20:11:00 2022 +0000

description:
pci_resource(9): vmem_create and vmem_add never fail with VM_SLEEP.

Prune dead error branches.

diffstat:

 sys/dev/pci/pci_resource.c |  15 +++++----------
 1 files changed, 5 insertions(+), 10 deletions(-)

diffs (39 lines):

diff -r cc8a5b084591 -r b4babc4be008 sys/dev/pci/pci_resource.c
--- a/sys/dev/pci/pci_resource.c        Sat Oct 15 20:00:35 2022 +0000
+++ b/sys/dev/pci/pci_resource.c        Sat Oct 15 20:11:00 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pci_resource.c,v 1.1 2022/10/14 22:10:15 jmcneill Exp $ */
+/* $NetBSD: pci_resource.c,v 1.2 2022/10/15 20:11:00 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2022 Jared McNeill <jmcneill%invisible.ca@localhost>
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pci_resource.c,v 1.1 2022/10/14 22:10:15 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_resource.c,v 1.2 2022/10/15 20:11:00 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -161,17 +161,12 @@
 pci_create_vmem(const char *name, bus_addr_t start, bus_addr_t end)
 {
        vmem_t *arena;
+       int error __diagused;
 
        arena = vmem_create(name, 0, 0, 1, NULL, NULL, NULL, 0, VM_SLEEP,
            IPL_NONE);
-       if (arena == NULL) {
-               return NULL;
-       }
-
-       if (vmem_add(arena, start, end - start + 1, VM_SLEEP) != 0) {
-               vmem_destroy(arena);
-               arena = NULL;
-       }
+       error = vmem_add(arena, start, end - start + 1, VM_SLEEP);
+       KASSERTMSG(error == 0, "error=%d", error);
 
        return arena;
 }



Home | Main Index | Thread Index | Old Index