Fix NULL dereference on Promise SX4 controllers, while executing commands

that do not require data transfer (FLUSHCACHE).

Tested by:	Magnus Kling <klingfon@gmail.com>
MFC after:	1 week
This commit is contained in:
Alexander Motin 2009-05-20 09:44:32 +00:00
parent 15344a5690
commit 74150c398a

View File

@ -1054,7 +1054,7 @@ ata_promise_sx4_command(struct ata_request *request)
device_t gparent = GRANDPARENT(request->dev);
struct ata_pci_controller *ctlr = device_get_softc(gparent);
struct ata_channel *ch = device_get_softc(request->parent);
struct ata_dma_prdentry *prd = request->dma->sg;
struct ata_dma_prdentry *prd;
caddr_t window = rman_get_virtual(ctlr->r_res1);
u_int32_t *wordp;
int i, idx, length = 0;
@ -1098,6 +1098,7 @@ ata_promise_sx4_command(struct ata_request *request)
case ATA_READ_DMA48:
case ATA_WRITE_DMA:
case ATA_WRITE_DMA48:
prd = request->dma->sg;
wordp = (u_int32_t *)
(window + (ch->unit * ATA_PDC_CHN_OFFSET) + ATA_PDC_HSG_OFFSET);
i = idx = 0;