[svn-commits] sruffell: branch linux/2.4 r9904 - /linux/branches/2.4/drivers/dahdi/wcte12xp/

SVN commits to the Digium repositories svn-commits at lists.digium.com
Thu Apr 14 15:32:31 CDT 2011


Author: sruffell
Date: Thu Apr 14 15:32:29 2011
New Revision: 9904

URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=9904
Log:
wcte12xp: If we cannot read the mode selection pins fail the module load.

Alexandre reported that on a particular server he would get a server
crash when loading the wcte12xp driver after receiving a line about a
timeout when trying to read the mode selection jumpers.

If the driver times out when trying to read the mode selection bits
there is a serious problem and it should not try to continue on with
configuration / registration.

Reported-and-Tested-by: Alexandre Abreu <alexandre.abreu at redt.com.br>
Signed-off-by: Shaun Ruffell <sruffell at digium.com>

Origin: http://svnview.digium.com/svn/dahdi?view=rev&rev=9902

Modified:
    linux/branches/2.4/drivers/dahdi/wcte12xp/base.c

Modified: linux/branches/2.4/drivers/dahdi/wcte12xp/base.c
URL: http://svnview.digium.com/svn/dahdi/linux/branches/2.4/drivers/dahdi/wcte12xp/base.c?view=diff&rev=9904&r1=9903&r2=9904
==============================================================================
--- linux/branches/2.4/drivers/dahdi/wcte12xp/base.c (original)
+++ linux/branches/2.4/drivers/dahdi/wcte12xp/base.c Thu Apr 14 15:32:29 2011
@@ -628,11 +628,21 @@
 	submit_cmd(wc, cmd);
 }
 
-static inline int t1_getpins(struct t1 *wc, int inisr)
+/**
+ * t1_getpins - Returns the value of the jumpers on the card.
+ * @wc:	The card to read from.
+ * @pins: Pointer to u8 character to hold the pins value.
+ *
+ * Returns 0 on success, otherwise an error code.
+ *
+ */
+static int t1_getpins(struct t1 *wc, u8 *pins)
 {
 	struct command *cmd;
 	unsigned long flags;
 	unsigned long ret;
+
+	*pins = 0;
 
 	cmd = get_free_cmd(wc);
 	BUG_ON(!cmd);
@@ -656,9 +666,9 @@
 		}
 		return ret;
 	}
-	ret = cmd->data;
+	*pins = cmd->data;
 	free_cmd(wc, cmd);
-	return ret;
+	return 0;
 }
 
 static void __t1xxp_set_clear(struct t1 *wc)
@@ -1639,6 +1649,7 @@
 
 static int t1_hardware_post_init(struct t1 *wc)
 {
+	int res;
 	unsigned int reg;
 	int x;
 
@@ -1649,10 +1660,12 @@
 		else
 			wc->spantype = TYPE_T1;
 	} else {
-		if (t1_getpins(wc,0) & 0x01) /* returns 1 for T1 mode */
-			wc->spantype = TYPE_T1;
-		else	
-			wc->spantype = TYPE_E1;
+		u8 pins;
+		res = t1_getpins(wc, &pins);
+		if (res)
+			return res;
+
+		wc->spantype = (pins & 0x01) ? TYPE_T1 : TYPE_E1;
 	}
 	debug_printk(wc, 1, "spantype: %s\n", 1 == wc->spantype ? "T1" : "E1");
 	
@@ -2327,7 +2340,13 @@
 		free_wc(wc);
 		return -EIO;
 	}
-	t1_hardware_post_init(wc);
+
+	res = t1_hardware_post_init(wc);
+	if (res) {
+		voicebus_release(&wc->vb);
+		free_wc(wc);
+		return res;
+	}
 
 	for (x = 0; x < (wc->spantype == TYPE_E1 ? 31 : 24); x++) {
 		if (!(wc->chans[x] = kmalloc(sizeof(*wc->chans[x]), GFP_KERNEL))) {




More information about the svn-commits mailing list