Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/x86/pci Correct return value handling.



details:   https://anonhg.NetBSD.org/src/rev/111a4938e186
branches:  trunk
changeset: 330714:111a4938e186
user:      hikaru <hikaru%NetBSD.org@localhost>
date:      Sat Jul 19 06:12:24 2014 +0000

description:
Correct return value handling.
m_defrag(9) is different from OpenBSD one,
it returns new mbuf pointer on success, not zero.

diffstat:

 sys/arch/x86/pci/if_vmx.c |  16 +++++++++-------
 1 files changed, 9 insertions(+), 7 deletions(-)

diffs (37 lines):

diff -r 8208f9208ee1 -r 111a4938e186 sys/arch/x86/pci/if_vmx.c
--- a/sys/arch/x86/pci/if_vmx.c Fri Jul 18 22:54:53 2014 +0000
+++ b/sys/arch/x86/pci/if_vmx.c Sat Jul 19 06:12:24 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_vmx.c,v 1.3 2014/06/19 13:20:28 hikaru Exp $        */
+/*     $NetBSD: if_vmx.c,v 1.4 2014/07/19 06:12:24 hikaru Exp $        */
 /*     $OpenBSD: if_vmx.c,v 1.16 2014/01/22 06:04:17 brad Exp $        */
 
 /*
@@ -18,7 +18,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_vmx.c,v 1.3 2014/06/19 13:20:28 hikaru Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_vmx.c,v 1.4 2014/07/19 06:12:24 hikaru Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -1145,11 +1145,13 @@
        case 0:
                break;
        case EFBIG:
-               if (m_defrag(m, M_DONTWAIT) == 0 &&
-                   bus_dmamap_load_mbuf(sc->sc_dmat, map, m,
-                    BUS_DMA_NOWAIT) == 0)
-                       break;
-
+               mp = m_defrag(m, M_DONTWAIT);
+               if (mp != NULL) {
+                       m = mp;
+                       if (bus_dmamap_load_mbuf(sc->sc_dmat, map, m,
+                           BUS_DMA_NOWAIT) == 0)
+                               break;
+               }
                /* FALLTHROUGH */
        default:
                m_freem(m);



Home | Main Index | Thread Index | Old Index