lkml.org 
[lkml]   [2005]   [Nov]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[git patches] 2.6.x libata fix

    Please pull from 'upstream-linus' branch of
    master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/libata-dev.git

    to receive the following fix:

    drivers/scsi/libata-core.c | 10 ++++++++--
    1 files changed, 8 insertions(+), 2 deletions(-)

    Tejun Heo:
    [libata] restore sg on DMA mapping failure

    diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c
    index e1346cd..1c1a7ca 100644
    --- a/drivers/scsi/libata-core.c
    +++ b/drivers/scsi/libata-core.c
    @@ -2622,8 +2622,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;
    @@ -2694,8 +2697,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);

    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/
    \
     
     \ /
      Last update: 2005-11-05 20:53    [W:0.019 / U:94.392 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site