public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Tim Hockin <thockin@sun.com>
To: alan@redhat.com,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: [PATCH]  Minor misc SCSI tweaks
Date: Tue, 10 Jul 2001 00:16:50 -0700	[thread overview]
Message-ID: <3B4AABE2.99475E56@sun.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 246 bytes --]

All,

Attached is a small patch fixing some minor misc. SCSI issues (Duncan
Laurie's work).  These are against 2.4.6, for general inclusion.

Tim

-- 
Tim Hockin
Systems Software Engineer
Sun Microsystems, Cobalt Server Appliances
thockin@sun.com

[-- Attachment #2: scsi_misc.diff --]
[-- Type: text/plain, Size: 1868 bytes --]

diff -ruN dist-2.4.6/drivers/scsi/scsi.c cobalt-2.4.6/drivers/scsi/scsi.c
--- dist-2.4.6/drivers/scsi/scsi.c	Tue Jun 12 11:06:54 2001
+++ cobalt-2.4.6/drivers/scsi/scsi.c	Mon Jul  9 11:04:11 2001
@@ -82,7 +82,7 @@
 #endif
 
 /*
-   static const char RCSid[] = "$Header: /vger/u4/cvs/linux/drivers/scsi/scsi.c,v 1.38 1997/01/19 23:07:18 davem Exp $";
+   static const char RCSid[] = "$Header: /home/cvs/linux-2.4/drivers/scsi/scsi.c,v 1.1.1.4 2001/05/30 01:05:04 thockin Exp $";
  */
 
 /*
@@ -1823,6 +1823,8 @@
 				 */
 	pcount = next_scsi_host;
 
+	MOD_INC_USE_COUNT;
+
 	/* The detect routine must carefully spinunlock/spinlock if 
 	   it enables interrupts, since all interrupt handlers do 
 	   spinlock as well.
@@ -1952,8 +1954,6 @@
 	       (scsi_init_memory_start - scsi_memory_lower_value) / 1024,
 	       (scsi_memory_upper_value - scsi_init_memory_start) / 1024);
 #endif
-
-	MOD_INC_USE_COUNT;
 
 	if (out_of_space) {
 		scsi_unregister_host(tpnt);	/* easiest way to clean up?? */
diff -ruN dist-2.4.6/drivers/scsi/sd.c cobalt-2.4.6/drivers/scsi/sd.c
--- dist-2.4.6/drivers/scsi/sd.c	Tue Jun 12 11:17:17 2001
+++ cobalt-2.4.6/drivers/scsi/sd.c	Mon Jul  9 11:04:11 2001
@@ -145,6 +151,9 @@
 	int diskinfo[4];
     
 	SDev = rscsi_disks[DEVICE_NR(dev)].device;
+	if (!SDev)
+		return -ENODEV;
+
 	/*
 	 * If we are in the middle of error recovery, don't let anyone
 	 * else try and use this device.  Also, if error recovery fails, it
@@ -502,6 +515,8 @@
 
 	target = DEVICE_NR(inode->i_rdev);
 	SDev = rscsi_disks[target].device;
+	if (!SDev)
+		return -ENODEV;
 
 	SDev->access_count--;
 
@@ -734,8 +759,15 @@
 	 */
 
 	SRpnt = scsi_allocate_request(rscsi_disks[i].device);
+	if (!SRpnt)
+		return i;
 
 	buffer = (unsigned char *) scsi_malloc(512);
+	if (!buffer) {
+		scsi_release_request(SRpnt);
+		SRpnt = NULL;
+		return i;
+	}
 
 	spintime = 0;
 

             reply	other threads:[~2001-07-10  7:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-07-10  7:16 Tim Hockin [this message]
2001-07-10  9:47 ` [PATCH] Minor misc SCSI tweaks Alan Cox

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3B4AABE2.99475E56@sun.com \
    --to=thockin@sun.com \
    --cc=alan@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox