Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/scsipi If scsipi_make_xs() fails, make sure to flag ...



details:   https://anonhg.NetBSD.org/src/rev/97c52401323f
branches:  trunk
changeset: 475877:97c52401323f
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Sat Aug 28 22:28:35 1999 +0000

description:
If scsipi_make_xs() fails, make sure to flag the buffer as error'd,
if provided, and biodone() it.  Callers of scsipi_command() expect
this to be done.

diffstat:

 sys/dev/scsipi/atapi_base.c |  12 ++++++++++--
 sys/dev/scsipi/scsi_base.c  |  12 ++++++++++--
 2 files changed, 20 insertions(+), 4 deletions(-)

diffs (54 lines):

diff -r 978d6a17d491 -r 97c52401323f sys/dev/scsipi/atapi_base.c
--- a/sys/dev/scsipi/atapi_base.c       Sat Aug 28 21:42:35 1999 +0000
+++ b/sys/dev/scsipi/atapi_base.c       Sat Aug 28 22:28:35 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: atapi_base.c,v 1.12 1999/06/25 18:58:54 thorpej Exp $  */
+/*     $NetBSD: atapi_base.c,v 1.13 1999/08/28 22:28:35 thorpej Exp $  */
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -226,8 +226,16 @@
 #endif
 
        if ((xs = scsipi_make_xs(sc_link, scsipi_cmd, cmdlen, data_addr,
-           datalen, retries, timeout, bp, flags)) == NULL)
+           datalen, retries, timeout, bp, flags)) == NULL) {
+               if (bp != NULL) {
+                       s = splbio();
+                       bp->b_flags |= B_ERROR;
+                       bp->b_error = ENOMEM;
+                       biodone(bp);
+                       splx(s);
+               }
                return (ENOMEM);
+       }
 
        xs->cmdlen = (sc_link->scsipi_atapi.cap & ACAP_LEN) ? 16 : 12;
 
diff -r 978d6a17d491 -r 97c52401323f sys/dev/scsipi/scsi_base.c
--- a/sys/dev/scsipi/scsi_base.c        Sat Aug 28 21:42:35 1999 +0000
+++ b/sys/dev/scsipi/scsi_base.c        Sat Aug 28 22:28:35 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: scsi_base.c,v 1.67 1999/06/12 11:19:00 pk Exp $        */
+/*     $NetBSD: scsi_base.c,v 1.68 1999/08/28 22:28:35 thorpej Exp $   */
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -102,8 +102,16 @@
 #endif
 
        if ((xs = scsipi_make_xs(sc_link, scsipi_cmd, cmdlen, data_addr,
-           datalen, retries, timeout, bp, flags)) == NULL)
+           datalen, retries, timeout, bp, flags)) == NULL) {
+               if (bp != NULL) {
+                       s = splbio();
+                       bp->b_flags |= B_ERROR;
+                       bp->b_error = ENOMEM;
+                       biodone(bp);
+                       splx(s);
+               }
                return (ENOMEM);
+       }
 
        /*
         * Set the LUN in the CDB if we have an older device.  We also



Home | Main Index | Thread Index | Old Index