[svn-commits] sruffell: linux/trunk r8831 - /linux/trunk/drivers/dahdi/wctc4xxp/base.c

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


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

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

gcc 4.5.0 was generating a warning on the changed line, and the
discussion at http://gcc.gnu.org/ml/gcc/2004-10/msg00024.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/wctc4xxp/base.c

Modified: linux/trunk/drivers/dahdi/wctc4xxp/base.c
URL: http://svnview.digium.com/svn/dahdi/linux/trunk/drivers/dahdi/wctc4xxp/base.c?view=diff&rev=8831&r1=8830&r2=8831
==============================================================================
--- linux/trunk/drivers/dahdi/wctc4xxp/base.c (original)
+++ linux/trunk/drivers/dahdi/wctc4xxp/base.c Tue Jun 29 15:20:19 2010
@@ -934,7 +934,7 @@
 
 	SET_OWNED(d); /* That's it until the hardware is done with it. */
 	dr->pending[dr->tail] = c;
-	dr->tail = ++dr->tail & DRING_MASK;
+	dr->tail = (dr->tail + 1) & DRING_MASK;
 	++dr->count;
 	spin_unlock_irqrestore(&dr->lock, flags);
 	return 0;




More information about the svn-commits mailing list