]> Git Repo - J-linux.git/commitdiff
ata: pata_marvell: Check the 'bmdma_addr' beforing reading
authorZheyu Ma <[email protected]>
Thu, 21 Apr 2022 01:39:20 +0000 (09:39 +0800)
committerDamien Le Moal <[email protected]>
Thu, 21 Apr 2022 23:45:06 +0000 (08:45 +0900)
Before detecting the cable type on the dma bar, the driver should check
whether the 'bmdma_addr' is zero, which means the adapter does not
support DMA, otherwise we will get the following error:

[    5.146634] Bad IO access at port 0x1 (return inb(port))
[    5.147206] WARNING: CPU: 2 PID: 303 at lib/iomap.c:44 ioread8+0x4a/0x60
[    5.150856] RIP: 0010:ioread8+0x4a/0x60
[    5.160238] Call Trace:
[    5.160470]  <TASK>
[    5.160674]  marvell_cable_detect+0x6e/0xc0 [pata_marvell]
[    5.161728]  ata_eh_recover+0x3520/0x6cc0
[    5.168075]  ata_do_eh+0x49/0x3c0

Signed-off-by: Zheyu Ma <[email protected]>
Signed-off-by: Damien Le Moal <[email protected]>
drivers/ata/pata_marvell.c

index 0c5a51970fbf54994b1536cb5c04dbbe9ec1b95c..014ccb0f45dc4628f8422d079f31727759c3537c 100644 (file)
@@ -77,6 +77,8 @@ static int marvell_cable_detect(struct ata_port *ap)
        switch(ap->port_no)
        {
        case 0:
+               if (!ap->ioaddr.bmdma_addr)
+                       return ATA_CBL_PATA_UNK;
                if (ioread8(ap->ioaddr.bmdma_addr + 1) & 1)
                        return ATA_CBL_PATA40;
                return ATA_CBL_PATA80;
This page took 0.055779 seconds and 4 git commands to generate.