Commit ad28d878 authored by Randy Dunlap's avatar Randy Dunlap Committed by James Bottomley

[PATCH] aha1542: queuecommand: change panic() to return

From: Timmy Yee <shoujun@masterofpi.org>

The aha1542 driver calls panic() if kmalloc() fails, which it shouldn't
do. This patch changes that by having the code return a nonzero value, so
it tells the SCSI mid-layer to retry the command, as suggested by Randy.


diffstat:=
 drivers/scsi/aha1542.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
parent 4195d656
...@@ -707,8 +707,11 @@ static int aha1542_queuecommand(Scsi_Cmnd * SCpnt, void (*done) (Scsi_Cmnd *)) ...@@ -707,8 +707,11 @@ static int aha1542_queuecommand(Scsi_Cmnd * SCpnt, void (*done) (Scsi_Cmnd *))
SCpnt->host_scribble = (unsigned char *) kmalloc(512, GFP_DMA); SCpnt->host_scribble = (unsigned char *) kmalloc(512, GFP_DMA);
sgpnt = (struct scatterlist *) SCpnt->request_buffer; sgpnt = (struct scatterlist *) SCpnt->request_buffer;
cptr = (struct chain *) SCpnt->host_scribble; cptr = (struct chain *) SCpnt->host_scribble;
if (cptr == NULL) if (cptr == NULL) {
panic("aha1542.c: unable to allocate DMA memory\n"); /* free the claimed mailbox slot */
HOSTDATA(SCpnt->device->host)->SCint[mbo] = NULL;
return SCSI_MLQUEUE_HOST_BUSY;
}
for (i = 0; i < SCpnt->use_sg; i++) { for (i = 0; i < SCpnt->use_sg; i++) {
if (sgpnt[i].length == 0 || SCpnt->use_sg > 16 || if (sgpnt[i].length == 0 || SCpnt->use_sg > 16 ||
(((int) sgpnt[i].offset) & 1) || (sgpnt[i].length & 1)) { (((int) sgpnt[i].offset) & 1) || (sgpnt[i].length & 1)) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment