public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
* [patch 1/2] SCSI: advansys: handle errors from scsi_dma_map()
@ 2011-09-20  6:47 Dan Carpenter
  0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2011-09-20  6:47 UTC (permalink / raw)
  To: Matthew Wilcox
  Cc: James E.J. Bottomley, open list:ADVANSYS SCSI DRIVER,
	kernel-janitors

scsi_dma_map() returns -ENOMEM on error.

Signed-off-by: Dan Carpenter <error27@gmail.com>

diff --git a/drivers/scsi/advansys.c b/drivers/scsi/advansys.c
index bfd618a..04035af 100644
--- a/drivers/scsi/advansys.c
+++ b/drivers/scsi/advansys.c
@@ -8427,6 +8427,12 @@ static int asc_build_req(struct asc_board *boardp, struct scsi_cmnd *scp,
 
 	/* Build ASC_SCSI_Q */
 	use_sg = scsi_dma_map(scp);
+	if (use_sg < 0) {
+		scsi_dma_unmap(scp);
+		scp->result = HOST_BYTE(DID_SOFT_ERROR);
+		return ASC_ERROR;
+	}
+
 	if (use_sg != 0) {
 		int sgcnt;
 		struct scatterlist *slp;

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2011-09-20  6:47 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-20  6:47 [patch 1/2] SCSI: advansys: handle errors from scsi_dma_map() Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox