[prev in list] [next in list] [prev in thread] [next in thread] 

List:       linux-ide
Subject:    [PATCH] pata_artop: Fix device ID parity check
From:       Jean Delvare <jdelvare () suse ! de>
Date:       2010-08-30 15:37:05
Message-ID: 201008301737.05459.jdelvare () suse ! de
[Download RAW message or body]

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

Signed-off-by: Jean Delvare <jdelvare@suse.de>
Cc: Jeff Garzik <jgarzik@pobox.com>
Cc: Alan Cox <alan@linux.intel.com>
---
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(-)

--- linux-2.6.36-rc3.orig/drivers/ata/pata_artop.c	2010-08-02 00:11:14.000000000 +0200
+++ linux-2.6.36-rc3/drivers/ata/pata_artop.c	2010-08-30 17:07:17.000000000 +0200
@@ -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);

-- 
Jean Delvare
Suse L3
--
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic