Skip to content

Commit aafa9f9

Browse files
ZheyuMaDamien Le Moal
authored andcommitted
ata: pata_marvell: Check the 'bmdma_addr' beforing reading
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 <zheyuma97@gmail.com> Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
1 parent 55b0141 commit aafa9f9

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/ata/pata_marvell.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@ static int marvell_cable_detect(struct ata_port *ap)
7777
switch(ap->port_no)
7878
{
7979
case 0:
80+
if (!ap->ioaddr.bmdma_addr)
81+
return ATA_CBL_PATA_UNK;
8082
if (ioread8(ap->ioaddr.bmdma_addr + 1) & 1)
8183
return ATA_CBL_PATA40;
8284
return ATA_CBL_PATA80;

0 commit comments

Comments
 (0)