diff options
author | Tzafrir Cohen <tzafrir.cohen@xorcom.com> | 2011-10-26 19:06:32 +0000 |
---|---|---|
committer | Tzafrir Cohen <tzafrir.cohen@xorcom.com> | 2011-10-26 19:06:32 +0000 |
commit | e87d8320847049338bab87281737e7bdfcfad1b1 (patch) | |
tree | d40081c475d470e1a8873dd50026b07043033dd7 /drivers | |
parent | 30e341e403f85e9376507c9e8044f5cf6861eae1 (diff) |
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@xorcom.com>
git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10282 a0bf4364-ded3-4de4-8d8a-66a801d63aff
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/dahdi/xpp/xbus-core.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/drivers/dahdi/xpp/xbus-core.c b/drivers/dahdi/xpp/xbus-core.c index 7fe0493..b2f7616 100644 --- a/drivers/dahdi/xpp/xbus-core.c +++ b/drivers/dahdi/xpp/xbus-core.c @@ -939,14 +939,16 @@ static void xbus_unregister_dahdi_device(xbus_t *xbus) 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); |