Skip to contentSkip to conversation

pata_artop: Fix device ID parity check

PATCH New Jean Delvare 1 participant 1 message Aug 30, 2010 libata

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pata_artop: Fix device ID parity check

x % 1 always evaluates to 0, which clearly isn't the intent. The author probably had "% 2" or "& 1" in mind, and mispelled it.

---
Notice: I don't have the hardware so this fix is untested, bug was found by code inspection.

 drivers/ata/pata_artop.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/ata/pata_artop.c +2 -1
@@ -74,7 +74,8 @@ static int artop6260_pre_reset(struct at
 	struct pci_dev *pdev = to_pci_dev(ap->host->dev);
 
 	/* Odd numbered device ids are the units with enable bits (the -R cards) */
-	if (pdev->device % 1 && !pci_test_config_bits(pdev, &artop_enable_bits[ap->port_no]))
+	if ((pdev->device & 1) &&
+	    !pci_test_config_bits(pdev, &artop_enable_bits[ap->port_no]))
 		return -ENOENT;
 
 	return ata_sff_prereset(link, deadline);
Signature · 2 lines
Jean Delvare
Suse L3