]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - drivers/ide/serverworks.c
Merge tag 'microblaze-v5.6-rc1' of git://git.monstr.eu/linux-2.6-microblaze
[linux.git] / drivers / ide / serverworks.c
index ac6fc3fffa0de500dc46ebf0feebf703faae8621..458e72e034b09ab2f0d7f5e558069c50c34be117 100644 (file)
@@ -115,6 +115,9 @@ static void svwks_set_pio_mode(ide_hwif_t *hwif, ide_drive_t *drive)
        struct pci_dev *dev = to_pci_dev(hwif->dev);
        const u8 pio = drive->pio_mode - XFER_PIO_0;
 
+       if (drive->dn >= ARRAY_SIZE(drive_pci))
+               return;
+
        pci_write_config_byte(dev, drive_pci[drive->dn], pio_modes[pio]);
 
        if (svwks_csb_check(dev)) {
@@ -141,6 +144,9 @@ static void svwks_set_dma_mode(ide_hwif_t *hwif, ide_drive_t *drive)
 
        u8 ultra_enable  = 0, ultra_timing = 0, dma_timing = 0;
 
+       if (drive->dn >= ARRAY_SIZE(drive_pci2))
+               return;
+
        pci_read_config_byte(dev, (0x56|hwif->channel), &ultra_timing);
        pci_read_config_byte(dev, 0x54, &ultra_enable);