* [PATCH] ata: pata_marvell: Check the 'bmdma_addr' beforing reading
@ 2022-04-20 12:21 Zheyu Ma
2022-04-20 22:33 ` Damien Le Moal
0 siblings, 1 reply; 2+ messages in thread
From: Zheyu Ma @ 2022-04-20 12:21 UTC (permalink / raw)
To: s.shtylyov, damien.lemoal; +Cc: linux-ide, linux-kernel, Zheyu Ma
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>
---
drivers/ata/pata_marvell.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/ata/pata_marvell.c b/drivers/ata/pata_marvell.c
index 0c5a51970fbf..d2922699be5e 100644
--- a/drivers/ata/pata_marvell.c
+++ b/drivers/ata/pata_marvell.c
@@ -77,7 +77,9 @@ static int marvell_cable_detect(struct ata_port *ap)
switch(ap->port_no)
{
case 0:
- if (ioread8(ap->ioaddr.bmdma_addr + 1) & 1)
+ if (!ap->ioaddr.bmdma_addr)
+ return ATA_CBL_PATA_UNK;
+ else if (ioread8(ap->ioaddr.bmdma_addr + 1) & 1)
return ATA_CBL_PATA40;
return ATA_CBL_PATA80;
case 1: /* Legacy SATA port */
--
2.25.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] ata: pata_marvell: Check the 'bmdma_addr' beforing reading
2022-04-20 12:21 [PATCH] ata: pata_marvell: Check the 'bmdma_addr' beforing reading Zheyu Ma
@ 2022-04-20 22:33 ` Damien Le Moal
0 siblings, 0 replies; 2+ messages in thread
From: Damien Le Moal @ 2022-04-20 22:33 UTC (permalink / raw)
To: Zheyu Ma, s.shtylyov; +Cc: linux-ide, linux-kernel
On 4/20/22 21:21, Zheyu Ma wrote:
> 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>
> ---
> drivers/ata/pata_marvell.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/ata/pata_marvell.c b/drivers/ata/pata_marvell.c
> index 0c5a51970fbf..d2922699be5e 100644
> --- a/drivers/ata/pata_marvell.c
> +++ b/drivers/ata/pata_marvell.c
> @@ -77,7 +77,9 @@ static int marvell_cable_detect(struct ata_port *ap)
> switch(ap->port_no)
> {
> case 0:
> - if (ioread8(ap->ioaddr.bmdma_addr + 1) & 1)
> + if (!ap->ioaddr.bmdma_addr)
> + return ATA_CBL_PATA_UNK;
> + else if (ioread8(ap->ioaddr.bmdma_addr + 1) & 1)
No need for the "else" here.
> return ATA_CBL_PATA40;
> return ATA_CBL_PATA80;
> case 1: /* Legacy SATA port */
--
Damien Le Moal
Western Digital Research
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-04-20 22:34 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-20 12:21 [PATCH] ata: pata_marvell: Check the 'bmdma_addr' beforing reading Zheyu Ma
2022-04-20 22:33 ` Damien Le Moal
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®