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

SVN commits to the Digium repositories svn-commits at lists.digium.com
Mon Sep 20 15:33:27 CDT 2010


Author: sruffell
Date: Mon Sep 20 15:33:23 2010
New Revision: 9366

URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=9366
Log:
dahdi: Reduce 'chans' dereferencing in dahdi_check_conf

Review: https://reviewboard.asterisk.org/r/905/

Signed-off-by: Shaun Ruffell <sruffell at digium.com>

Modified:
    linux/trunk/drivers/dahdi/dahdi-base.c

Modified: linux/trunk/drivers/dahdi/dahdi-base.c
URL: http://svnview.digium.com/svn/dahdi/linux/trunk/drivers/dahdi/dahdi-base.c?view=diff&rev=9366&r1=9365&r2=9366
==============================================================================
--- linux/trunk/drivers/dahdi/dahdi-base.c (original)
+++ linux/trunk/drivers/dahdi/dahdi-base.c Mon Sep 20 15:33:23 2010
@@ -922,12 +922,14 @@
 		return;
 
 	for (y = 0; y < maxchans; y++) {
-		if (chans[y] && (chans[y]->confna == x) &&
-				((chans[y]->confmode & DAHDI_CONF_MODE_MASK) == DAHDI_CONF_CONF ||
-				(chans[y]->confmode & DAHDI_CONF_MODE_MASK) == DAHDI_CONF_CONFANN ||
-				(chans[y]->confmode & DAHDI_CONF_MODE_MASK) == DAHDI_CONF_CONFMON ||
-				(chans[y]->confmode & DAHDI_CONF_MODE_MASK) == DAHDI_CONF_CONFANNMON ||
-				(chans[y]->confmode & DAHDI_CONF_MODE_MASK) == DAHDI_CONF_REALANDPSEUDO)) {
+		struct dahdi_chan *const chan = chans[y];
+		const int confmode = chan->confmode & DAHDI_CONF_MODE_MASK;
+		if (chan && (chan->confna == x) &&
+		    (confmode == DAHDI_CONF_CONF ||
+		     confmode == DAHDI_CONF_CONFANN ||
+		     confmode == DAHDI_CONF_CONFMON ||
+		     confmode == DAHDI_CONF_CONFANNMON ||
+		     confmode == DAHDI_CONF_REALANDPSEUDO)) {
 			return;
 		}
 	}




More information about the svn-commits mailing list