[svn-commits] sruffell: linux/trunk r8832 - /linux/trunk/drivers/dahdi/voicebus/voicebus.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Tue Jun 29 15:20:26 CDT 2010


Author: sruffell
Date: Tue Jun 29 15:20:20 2010
New Revision: 8832

URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=8832
Log:
wctdm24xxp, wcte12xp: Fix "operation on may be undefined" warning.

gcc 4.5.0 generates a warning on the changed lines and
http://gcc.gnu.org/ml/gcc/2004-10/msg00032.html explains why.

Essentially, the only thing guaranteed with the preincrement operator is that
the value will be incremented before the assignment.  It's undefined where in
the sequence the mask will be applied.

Modified:
    linux/trunk/drivers/dahdi/voicebus/voicebus.c

Modified: linux/trunk/drivers/dahdi/voicebus/voicebus.c
URL: http://svnview.digium.com/svn/dahdi/linux/trunk/drivers/dahdi/voicebus/voicebus.c?view=diff&rev=8832&r1=8831&r2=8832
==============================================================================
--- linux/trunk/drivers/dahdi/voicebus/voicebus.c (original)
+++ linux/trunk/drivers/dahdi/voicebus/voicebus.c Tue Jun 29 15:20:20 2010
@@ -614,7 +614,7 @@
 	dl->pending[dl->tail] = vbb;
 	d->buffer1 = dma_map_single(&vb->pdev->dev, vbb->data,
 				    sizeof(vbb->data), DMA_TO_DEVICE);
-	dl->tail = (++(dl->tail)) & DRING_MASK;
+	dl->tail = (dl->tail + 1) & DRING_MASK;
 	SET_OWNED(d); /* That's it until the hardware is done with it. */
 	atomic_inc(&dl->count);
 	return 0;
@@ -1309,7 +1309,7 @@
 			if (d->buffer1 != vb->idle_vbb_dma_addr)
 				goto tx_error_exit;
 			SET_OWNED(d);
-			dl->head = ++dl->head & DRING_MASK;
+			dl->head = (dl->head + 1) & DRING_MASK;
 			d = vb_descriptor(dl, dl->head);
 			++behind;
 		}
@@ -1334,7 +1334,7 @@
 			if (d->buffer1 != vb->idle_vbb_dma_addr)
 				goto tx_error_exit;
 			SET_OWNED(d);
-			dl->head = ++dl->head & DRING_MASK;
+			dl->head = (dl->head + 1) & DRING_MASK;
 			d = vb_descriptor(dl, dl->head);
 			++behind;
 		}
@@ -1344,7 +1344,7 @@
 			d->buffer1 = vb->idle_vbb_dma_addr;
 			dl->pending[dl->head] = vb->idle_vbb;
 			d->des0 |= OWN_BIT;
-			dl->head = ++dl->head & DRING_MASK;
+			dl->head = (dl->head + 1) & DRING_MASK;
 		}
 		dl->tail = dl->head;
 	}




More information about the svn-commits mailing list