Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/spi We always need bp->b_resid initialized before we...



details:   https://anonhg.NetBSD.org/src/rev/824a4bfea02e
branches:  trunk
changeset: 358665:824a4bfea02e
user:      jakllsch <jakllsch%NetBSD.org@localhost>
date:      Fri Jan 12 19:38:52 2018 +0000

description:
We always need bp->b_resid initialized before we try to toss the transfer.

diffstat:

 sys/dev/spi/spiflash.c |  10 ++++------
 1 files changed, 4 insertions(+), 6 deletions(-)

diffs (48 lines):

diff -r 8717f30d94c2 -r 824a4bfea02e sys/dev/spi/spiflash.c
--- a/sys/dev/spi/spiflash.c    Fri Jan 12 18:54:37 2018 +0000
+++ b/sys/dev/spi/spiflash.c    Fri Jan 12 19:38:52 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: spiflash.c,v 1.19 2016/08/19 03:23:39 jakllsch Exp $ */
+/* $NetBSD: spiflash.c,v 1.20 2018/01/12 19:38:52 jakllsch Exp $ */
 
 /*-
  * Copyright (c) 2006 Urbana-Champaign Independent Media Center.
@@ -42,7 +42,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: spiflash.c,v 1.19 2016/08/19 03:23:39 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: spiflash.c,v 1.20 2018/01/12 19:38:52 jakllsch Exp $");
 
 #include <sys/param.h>
 #include <sys/conf.h>
@@ -310,10 +310,11 @@
        spiflash_handle_t sc;
        int     s;
 
+       bp->b_resid = bp->b_bcount;
+
        sc = device_lookup_private(&spiflash_cd, DISKUNIT(bp->b_dev));
        if (sc == NULL) {
                bp->b_error = ENXIO;
-               bp->b_resid = bp->b_bcount;
                biodone(bp);
                return;
        }
@@ -321,7 +322,6 @@
        if (((bp->b_bcount % sc->sc_write_size) != 0) ||
            (bp->b_blkno < 0)) {
                bp->b_error = EINVAL;
-               bp->b_resid = bp->b_bcount;
                biodone(bp);
                return;
        }
@@ -338,8 +338,6 @@
                return;
        }
 
-       bp->b_resid = bp->b_bcount;
-
        /* all ready, hand off to thread for async processing */
        s = splbio();
        bufq_put(sc->sc_waitq, bp);



Home | Main Index | Thread Index | Old Index