Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/x86/x86 Don't call _bus_dmamem_free() when _bus_dma...



details:   https://anonhg.NetBSD.org/src/rev/81a5fecfc5fc
branches:  trunk
changeset: 748849:81a5fecfc5fc
user:      dsl <dsl%NetBSD.org@localhost>
date:      Fri Nov 06 23:10:10 2009 +0000

description:
Don't call _bus_dmamem_free() when _bus_dmamem_alloc() fails.
Fixes PR/42208

diffstat:

 sys/arch/x86/x86/bus_dma.c |  13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)

diffs (38 lines):

diff -r 6342b89abdbf -r 81a5fecfc5fc sys/arch/x86/x86/bus_dma.c
--- a/sys/arch/x86/x86/bus_dma.c        Fri Nov 06 23:09:10 2009 +0000
+++ b/sys/arch/x86/x86/bus_dma.c        Fri Nov 06 23:10:10 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bus_dma.c,v 1.51 2009/04/21 21:30:01 cegger Exp $      */
+/*     $NetBSD: bus_dma.c,v 1.52 2009/11/06 23:10:10 dsl Exp $ */
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2007 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.51 2009/04/21 21:30:01 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.52 2009/11/06 23:10:10 dsl Exp $");
 
 /*
  * The following is included because _bus_dma_uiomove is derived from
@@ -896,13 +896,16 @@
        error = _bus_dmamem_alloc(t, cookie->id_bouncebuflen,
            PAGE_SIZE, map->_dm_boundary, cookie->id_bouncesegs,
            map->_dm_segcnt, &cookie->id_nbouncesegs, flags);
-       if (error)
-               goto out;
+       if (error) {
+               cookie->id_bouncebuflen = 0;
+               cookie->id_nbouncesegs = 0;
+               return error;
+       }
+
        error = _bus_dmamem_map(t, cookie->id_bouncesegs,
            cookie->id_nbouncesegs, cookie->id_bouncebuflen,
            (void **)&cookie->id_bouncebuf, flags);
 
- out:
        if (error) {
                _bus_dmamem_free(t, cookie->id_bouncesegs,
                    cookie->id_nbouncesegs);



Home | Main Index | Thread Index | Old Index