summaryrefslogtreecommitdiff
path: root/addons/chan_mobile.c
diff options
context:
space:
mode:
Diffstat (limited to 'addons/chan_mobile.c')
-rw-r--r--addons/chan_mobile.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/addons/chan_mobile.c b/addons/chan_mobile.c
index bd39bee64..8f04af753 100644
--- a/addons/chan_mobile.c
+++ b/addons/chan_mobile.c
@@ -4704,9 +4704,13 @@ static int load_module(void)
ast_format_cap_append(mbl_tech.capabilities, DEVICE_FRAME_FORMAT, 0);
/* Check if we have Bluetooth, no point loading otherwise... */
dev_id = hci_get_route(NULL);
+
s = hci_open_dev(dev_id);
if (dev_id < 0 || s < 0) {
ast_log(LOG_ERROR, "No Bluetooth devices found. Not loading module.\n");
+ ao2_ref(mbl_tech.capabilities, -1);
+ mbl_tech.capabilities = NULL;
+ hci_close_dev(s);
return AST_MODULE_LOAD_DECLINE;
}
@@ -4714,6 +4718,8 @@ static int load_module(void)
if (mbl_load_config()) {
ast_log(LOG_ERROR, "Errors reading config file %s. Not loading module.\n", MBL_CONFIG);
+ ao2_ref(mbl_tech.capabilities, -1);
+ mbl_tech.capabilities = NULL;
return AST_MODULE_LOAD_DECLINE;
}
@@ -4738,10 +4744,9 @@ static int load_module(void)
return AST_MODULE_LOAD_SUCCESS;
e_cleanup:
- if (sdp_session)
- sdp_close(sdp_session);
+ unload_module();
- return AST_MODULE_LOAD_FAILURE;
+ return AST_MODULE_LOAD_DECLINE;
}
AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_LOAD_ORDER, "Bluetooth Mobile Device Channel Driver",