mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Tejun Heo <htejun@gmail.com>
To: Jeff Garzik <jgarzik@pobox.com>
Cc: linux-ide@vger.kernel.org, linux-scsi@vger.kernel.org,
	linux-kernel@vger.kernel.org, Jens Axboe <axboe@suse.de>,
	Alan Cox <alan@lxorguk.ukuu.org.uk>
Subject: Re: [PATCH 3] sata: restore sg on setup failure
Date: Sun, 7 Aug 2005 15:17:37 +0900	[thread overview]
Message-ID: <20050807061737.GA14913@htj.dyndns.org> (raw)
In-Reply-To: <20050807054850.GA13335@htj.dyndns.org>

 I forgot to restore sg->length on setup failure.  This patch adds it.


Signed-off-by: Tejun Heo <htejun@gmail.com>

Index: work/drivers/scsi/libata-core.c
===================================================================
--- work.orig/drivers/scsi/libata-core.c	2005-08-07 15:13:20.000000000 +0900
+++ work/drivers/scsi/libata-core.c	2005-08-07 15:15:27.000000000 +0900
@@ -2401,8 +2401,11 @@ static int ata_sg_setup_one(struct ata_q
 
 	dma_address = dma_map_single(ap->host_set->dev, qc->buf_virt,
 				     sg->length, dir);
-	if (dma_mapping_error(dma_address))
+	if (dma_mapping_error(dma_address)) {
+		/* restore sg */
+		sg->length += qc->pad_len;
 		return -1;
+	}
 
 	sg_dma_address(sg) = dma_address;
 	sg_dma_len(sg) = sg->length;
@@ -2473,8 +2476,11 @@ static int ata_sg_setup(struct ata_queue
 
 	dir = qc->dma_dir;
 	n_elem = dma_map_sg(ap->host_set->dev, sg, qc->n_elem, dir);
-	if (n_elem < 1)
+	if (n_elem < 1) {
+		/* restore last sg */
+		lsg->length += qc->pad_len;
 		return -1;
+	}
 
 	DPRINTK("%d sg elements mapped\n", n_elem);
 

  parent reply	other threads:[~2005-08-07  6:17 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-07-29  5:06 [RFC][PATCH] libata ATAPI alignment Jeff Garzik
2005-07-29 13:38 ` Alan Cox
2005-08-02  8:27 ` Jens Axboe
2005-08-02 14:31   ` Jeff Garzik
2005-08-07  5:48 ` Tejun Heo
2005-08-07  5:53   ` [PATCH 1/2] sata: fix sata_sx4 dma_prep to not use sg->length Tejun Heo
2005-08-10 21:24     ` Jeff Garzik
2005-08-07  5:58   ` Rd: [PATCH 2/2] sata: implement ATAPI alignment adjustment Tejun Heo
2005-08-07  6:17   ` Tejun Heo [this message]
2005-08-19  3:49   ` libata error handling Jeff Garzik
2005-08-19  5:40     ` Tejun Heo
2005-08-19  5:54       ` Jeff Garzik
2005-08-19 19:00       ` Luben Tuikov
2005-08-19 18:46     ` Luben Tuikov
2005-08-19 19:38       ` Patrick Mansfield
2005-08-19 20:03         ` Luben Tuikov
2005-08-19 20:11           ` Patrick Mansfield
2005-08-19 20:43             ` Luben Tuikov
2005-08-19 21:10               ` Patrick Mansfield
2005-08-19 22:37                 ` Luben Tuikov
2005-08-19 20:29           ` Mike Anderson
2005-08-19 21:02             ` Luben Tuikov

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=20050807061737.GA14913@htj.dyndns.org \
    --to=htejun@gmail.com \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=axboe@suse.de \
    --cc=jgarzik@pobox.com \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@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

all inboxes | Powered by JetHome®