lkml.org 
[lkml]   [2008]   [Sep]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Subject[PATCH 09/10] ide-atapi: protect ide_atapi_pc pointer from ide-cd code path
    Date
    From
    ... since it is undefined.

    There should be no functional change resulting from this patch.

    Signed-off-by: Borislav Petkov <petkovbb@gmail.com>
    ---
    drivers/ide/ide-atapi.c | 27 +++++++++++++++------------
    1 files changed, 15 insertions(+), 12 deletions(-)

    diff --git a/drivers/ide/ide-atapi.c b/drivers/ide/ide-atapi.c
    index 733a75a..45e88a9 100644
    --- a/drivers/ide/ide-atapi.c
    +++ b/drivers/ide/ide-atapi.c
    @@ -561,9 +561,16 @@ ide_startstop_t ide_issue_pc(ide_drive_t *drive, unsigned int timeout,
    u16 bcount;
    u8 scsi = !!(drive->dev_flags & IDE_DFLAG_SCSI);

    - /* We haven't transferred any data yet */
    - pc->xferred = 0;
    - pc->cur_pos = pc->buf;
    + if (!DEV_IS_IDECD(drive)) {
    + /* We haven't transferred any data yet */
    + pc->xferred = 0;
    + pc->cur_pos = pc->buf;
    +
    + if (pc->flags & PC_FLAG_DMA_ERROR) {
    + pc->flags &= ~PC_FLAG_DMA_ERROR;
    + ide_dma_off(drive);
    + }
    + }

    /* Request to transfer the entire buffer at once */
    if (drive->media == ide_tape && scsi == 0)
    @@ -573,14 +580,10 @@ ide_startstop_t ide_issue_pc(ide_drive_t *drive, unsigned int timeout,
    else
    bcount = min(pc->req_xfer, 63 * 1024);

    - if (pc->flags & PC_FLAG_DMA_ERROR) {
    - pc->flags &= ~PC_FLAG_DMA_ERROR;
    - ide_dma_off(drive);
    - }
    -
    - if (((pc->flags & PC_FLAG_DMA_OK) &&
    - (drive->dev_flags & IDE_DFLAG_USING_DMA)) ||
    - (DEV_IS_IDECD(drive) && drive->dma)) {
    + if (drive->dma ||
    + (!DEV_IS_IDECD(drive) &&
    + (pc->flags & PC_FLAG_DMA_OK) &&
    + (drive->dev_flags & IDE_DFLAG_USING_DMA))) {
    if (scsi)
    hwif->sg_mapped = 1;
    drive->dma = !hwif->dma_ops->dma_setup(drive);
    @@ -588,7 +591,7 @@ ide_startstop_t ide_issue_pc(ide_drive_t *drive, unsigned int timeout,
    hwif->sg_mapped = 0;
    }

    - if (!drive->dma)
    + if (!drive->dma && !DEV_IS_IDECD(drive))
    pc->flags &= ~PC_FLAG_DMA_OK;

    if (scsi)
    --
    1.5.5.1


    \
     
     \ /
      Last update: 2008-09-14 13:41    [W:0.025 / U:1.580 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site