diff mbox

pata_legacy: bogus clock in opti82c46x_set_piomode()

Message ID 20130311114151.GB8235@longonot.mountain
State Not Applicable
Delegated to: David Miller
Headers show

Commit Message

Dan Carpenter March 11, 2013, 11:41 a.m. UTC
"sysclk" is used as an index into a 4 element array.  My static
checker complains because it can be out of bounds.  From the
context, it looks like there is a right bit shift missing.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
I don't have the hardware to test this.

--
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

Comments

Jeff Garzik April 3, 2013, 11:56 p.m. UTC | #1
On 03/11/2013 07:41 AM, Dan Carpenter wrote:
> "sysclk" is used as an index into a 4 element array.  My static
> checker complains because it can be out of bounds.  From the
> context, it looks like there is a right bit shift missing.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> I don't have the hardware to test this.

applied (to #upstream)



--
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
diff mbox

Patch

diff --git a/drivers/ata/pata_legacy.c b/drivers/ata/pata_legacy.c
index 4fe9d21..be81642 100644
--- a/drivers/ata/pata_legacy.c
+++ b/drivers/ata/pata_legacy.c
@@ -542,7 +542,7 @@  static void opti82c46x_set_piomode(struct ata_port *ap, struct ata_device *adev)
 	u8 sysclk;
 
 	/* Get the clock */
-	sysclk = opti_syscfg(0xAC) & 0xC0;	/* BIOS set */
+	sysclk = (opti_syscfg(0xAC) & 0xC0) >> 6;	/* BIOS set */
 
 	/* Enter configuration mode */
 	ioread16(ap->ioaddr.error_addr);