DORMANTno replies

[PATCH] net: wan: wanxl.c: Cleaning up declaration of a while loop

From: Rickard Strandqvist <hidden>
Date: 2014-06-07 11:02:46
Also in: lkml
Subsystem: generic hdlc (wan) drivers, networking drivers, the rest · Maintainers: Krzysztof Halasa, Andrew Lunn, "David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, Linus Torvalds

Unusual declaration of a while loop.
However, believe you also want to make sure that the pointer is not NULL

This was partly found using a static code analysis program called cppcheck.

Signed-off-by: Rickard Strandqvist <redacted>
---
 drivers/net/wan/wanxl.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/wan/wanxl.c b/drivers/net/wan/wanxl.c
index f76aa90..bde0943 100644
--- a/drivers/net/wan/wanxl.c
+++ b/drivers/net/wan/wanxl.c
@@ -196,7 +196,7 @@ static inline void wanxl_tx_intr(port_t *port)
 static inline void wanxl_rx_intr(card_t *card)
 {
 	desc_t *desc;
-	while (desc = &card->status->rx_descs[card->rx_in],
+	while (desc = &card->status->rx_descs[card->rx_in] &&
 	       desc->stat != PACKET_EMPTY) {
 		if ((desc->stat & PACKET_PORT_MASK) > card->n_ports)
 			pr_crit("%s: received packet for nonexistent port\n",
-- 
1.7.10.4
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help