Skip to contentSkip to conversation

staging/et131x: fix et131x_rx_dma_disable halt_status usage

PATCH In review Marcin Slusarz 2 participants 2 messages Feb 20, 2011 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging/et131x: fix et131x_rx_dma_disable halt_status usage

Commit 1bd751c1abc1029e8a0ae63ef4f19357c735a2a3 ("Staging: et131x: Clean up rxdma_csr") changed csr from bitfield to u32, but failed to convert 2 uses of halt_status bit. It did:

- if (csr.bits.halt_status != 1)
+ if ((csr & 0x00020000) != 1)

which is wrong, because second version is always true. Fix it.

This bug was found by coccinelle (http://coccinelle.lip6.fr/).

Cc Alan Cox <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
---
 drivers/staging/et131x/et1310_rx.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/staging/et131x/et1310_rx.c +2 -2
index 8e04bdd..a414830 100644
@@ -717,10 +717,10 @@ void et131x_rx_dma_disable(struct et131x_adapter *etdev)
 	/* Setup the receive dma configuration register */
 	writel(0x00002001, &etdev->regs->rxdma.csr);
 	csr = readl(&etdev->regs->rxdma.csr);
-	if ((csr & 0x00020000) != 1) {	/* Check halt status (bit 17) */
+	if ((csr & 0x00020000) == 0) {	/* Check halt status (bit 17) */
 		udelay(5);
 		csr = readl(&etdev->regs->rxdma.csr);
-		if ((csr & 0x00020000) != 1)
+		if ((csr & 0x00020000) == 0)
 			dev_err(&etdev->pdev->dev,
 			"RX Dma failed to enter halt state. CSR 0x%08x\n",
 				csr);
Signature · 1 line
1.7.4.rc3
Acked-by on v1 1/1
#1 lore raw
Quoted 7 lines · On Sun, 20 Feb 2011 20:03:34 +0100 Marcin Slusarz <[email protected]>…

Commit 1bd751c1abc1029e8a0ae63ef4f19357c735a2a3 ("Staging: et131x: Clean up rxdma_csr") changed csr from bitfield to u32, but failed to convert 2 uses of halt_status bit. It did:

- if (csr.bits.halt_status != 1)
+ if ((csr & 0x00020000) != 1)

Quoted 8 lines

which is wrong, because second version is always true. Fix it.

This bug was found by coccinelle (http://coccinelle.lip6.fr/).

Cc Alan Cox <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>