Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/ic Make sure that we do not call bus_space_*_multi_*...



details:   https://anonhg.NetBSD.org/src/rev/c6ab57713e85
branches:  trunk
changeset: 495542:c6ab57713e85
user:      briggs <briggs%NetBSD.org@localhost>
date:      Mon Jul 31 02:14:47 2000 +0000

description:
Make sure that we do not call bus_space_*_multi_* with zero count.

diffstat:

 sys/dev/ic/smc91cxx.c |  12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diffs (33 lines):

diff -r 6da41ca2658f -r c6ab57713e85 sys/dev/ic/smc91cxx.c
--- a/sys/dev/ic/smc91cxx.c     Mon Jul 31 02:06:48 2000 +0000
+++ b/sys/dev/ic/smc91cxx.c     Mon Jul 31 02:14:47 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: smc91cxx.c,v 1.26 2000/07/30 21:34:48 briggs Exp $     */
+/*     $NetBSD: smc91cxx.c,v 1.27 2000/07/31 02:14:47 briggs Exp $     */
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -687,8 +687,9 @@
         */
        for (top = m; m != NULL; m = m->m_next) {
                /* Words... */
-               bus_space_write_multi_2(bst, bsh, DATA_REG_W,
-                   mtod(m, u_int16_t *), m->m_len >> 1);
+               if (m->m_len > 1)
+                       bus_space_write_multi_2(bst, bsh, DATA_REG_W,
+                           mtod(m, u_int16_t *), m->m_len >> 1);
 
                /* ...and the remaining byte, if any. */
                if (m->m_len & 1)
@@ -1019,8 +1020,9 @@
         */
        eh = mtod(m, struct ether_header *);
        data = mtod(m, u_int8_t *);
-       bus_space_read_multi_2(bst, bsh, DATA_REG_W, (u_int16_t *)data,
-           packetlen >> 1);
+       if (packetlen > 1)
+               bus_space_read_multi_2(bst, bsh, DATA_REG_W, (u_int16_t *)data,
+                   packetlen >> 1);
        if (packetlen & 1) {
                data += packetlen & ~1;
                *data = bus_space_read_1(bst, bsh, DATA_REG_B);



Home | Main Index | Thread Index | Old Index