diff mbox series

pata_hpt3x2n: check channel enable bits

Message ID 66e64122-6201-4ae6-3c20-002ec929d5be@omp.ru
State New
Headers show
Series pata_hpt3x2n: check channel enable bits | expand

Commit Message

Sergey Shtylyov Feb. 5, 2022, 6:15 p.m. UTC
The dirver's prereset() method still doesn't check the channel enable bits.
The bug was there for the entire time the driver has existed. :-/

Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>

---
This patch is against the 'master' branch of Damien Le Moal's 'libata.git'
repo.

 drivers/ata/pata_hpt3x2n.c |    7 +++++++
 1 file changed, 7 insertions(+)

Comments

Sergey Shtylyov Feb. 5, 2022, 6:43 p.m. UTC | #1
On 2/5/22 9:15 PM, Sergey Shtylyov wrote:

> The dirver's prereset() method still doesn't check the channel enable bits.

   s/dirver/driver/, pleasee fix when applying! :-)

> The bug was there for the entire time the driver has existed. :-/
> 
> Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>

[...]

MBR, Sergey
Sergey Shtylyov Feb. 5, 2022, 6:49 p.m. UTC | #2
On 2/5/22 9:43 PM, Sergey Shtylyov wrote:

>> The dirver's prereset() method still doesn't check the channel enable bits.
> 
>    s/dirver/driver/, pleasee fix when applying! :-)

   I forgot to update DRV_VERSION, so v2 is iun order anyway.

>> The bug was there for the entire time the driver has existed. :-/
>>
>> Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>

[...]

MBR, Sergey
diff mbox series

Patch

Index: libata/drivers/ata/pata_hpt3x2n.c
===================================================================
--- libata.orig/drivers/ata/pata_hpt3x2n.c
+++ libata/drivers/ata/pata_hpt3x2n.c
@@ -168,6 +168,13 @@  static int hpt3x2n_pre_reset(struct ata_
 {
 	struct ata_port *ap = link->ap;
 	struct pci_dev *pdev = to_pci_dev(ap->host->dev);
+	static const struct pci_bits hpt3x2n_enable_bits[] = {
+		{ 0x50, 1, 0x04, 0x04 },
+		{ 0x54, 1, 0x04, 0x04 }
+	};
+
+	if (!pci_test_config_bits(pdev, &hpt3x2n_enable_bits[ap->port_no]))
+		return -ENOENT;
 
 	/* Reset the state machine */
 	pci_write_config_byte(pdev, 0x50 + 4 * ap->port_no, 0x37);