[svn-commits] tzafrir: linux/trunk r10282 - /linux/trunk/drivers/dahdi/xpp/xbus-core.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Wed Oct 26 14:06:36 CDT 2011


Author: tzafrir
Date: Wed Oct 26 14:06:32 2011
New Revision: 10282

URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=10282
Log:
xpp: make unregistration safer (idempotent)

 * Otherwise, a failed unit initialization (e.g: when init_card_?_?? fails)
   causes a panic

Signed-off-by: Oron Peled <oron.peled at xorcom.com>

Modified:
    linux/trunk/drivers/dahdi/xpp/xbus-core.c

Modified: linux/trunk/drivers/dahdi/xpp/xbus-core.c
URL: http://svnview.digium.com/svn/dahdi/linux/trunk/drivers/dahdi/xpp/xbus-core.c?view=diff&rev=10282&r1=10281&r2=10282
==============================================================================
--- linux/trunk/drivers/dahdi/xpp/xbus-core.c (original)
+++ linux/trunk/drivers/dahdi/xpp/xbus-core.c Wed Oct 26 14:06:32 2011
@@ -939,14 +939,16 @@
 		xpd_t *xpd = xpd_of(xbus, i);
 		xpd_dahdi_preunregister(xpd);
 	}
-	dahdi_unregister_device(xbus->ddev);
-	XBUS_NOTICE(xbus, "%s: finished dahdi_unregister_device()\n", __func__);
-	kfree(xbus->ddev->devicetype);
-	xbus->ddev->devicetype = NULL;
-	xbus->ddev->location = NULL;
-	xbus->ddev->hardware_id = NULL;
-	dahdi_free_device(xbus->ddev);
-	xbus->ddev = NULL;
+	if (xbus->ddev) {
+		dahdi_unregister_device(xbus->ddev);
+		XBUS_NOTICE(xbus, "%s: finished dahdi_unregister_device()\n", __func__);
+		kfree(xbus->ddev->devicetype);
+		xbus->ddev->devicetype = NULL;
+		xbus->ddev->location = NULL;
+		xbus->ddev->hardware_id = NULL;
+		dahdi_free_device(xbus->ddev);
+		xbus->ddev = NULL;
+	}
 	for(i = 0; i < MAX_XPDS; i++) {
 		xpd_t *xpd = xpd_of(xbus, i);
 		xpd_dahdi_postunregister(xpd);




More information about the svn-commits mailing list