summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/session.h2
-rw-r--r--plugins/session_policy_local.c13
-rw-r--r--src/session.c16
3 files changed, 5 insertions, 26 deletions
diff --git a/include/session.h b/include/session.h
index e77bd562..5b7e07bb 100644
--- a/include/session.h
+++ b/include/session.h
@@ -95,7 +95,7 @@ void connman_session_policy_unregister(struct connman_session_policy *config);
int connman_session_config_update(struct connman_session *session);
void connman_session_destroy(struct connman_session *session);
-int connman_session_set_default_config(struct connman_session_config *config);
+void connman_session_set_default_config(struct connman_session_config *config);
struct connman_session_config *connman_session_create_default_config(void);
enum connman_session_roaming_policy connman_session_parse_roaming_policy(const char *policy);
diff --git a/plugins/session_policy_local.c b/plugins/session_policy_local.c
index 7125f356..dfaeaea6 100644
--- a/plugins/session_policy_local.c
+++ b/plugins/session_policy_local.c
@@ -127,11 +127,6 @@ static struct policy_data *create_policy(const char *ident)
return NULL;
policy->config = connman_session_create_default_config();
- if (policy->config == NULL) {
- g_free(policy);
- return NULL;
- }
-
policy->refcount = 1;
policy->ident = g_strdup(ident);
@@ -369,7 +364,6 @@ static void update_session(struct connman_session *session)
static void remove_policy(struct policy_data *policy)
{
connman_bool_t update = FALSE;
- int err;
if (policy->session != NULL)
update = TRUE;
@@ -379,12 +373,7 @@ static void remove_policy(struct policy_data *policy)
if (update == FALSE)
return;
- err = connman_session_set_default_config(policy->config);
- if (err < 0) {
- connman_session_destroy(policy->session);
- return;
- }
-
+ connman_session_set_default_config(policy->config);
update_session(policy->session);
}
diff --git a/src/session.c b/src/session.c
index 5a6065f6..07db2f12 100644
--- a/src/session.c
+++ b/src/session.c
@@ -410,7 +410,7 @@ void connman_session_policy_unregister(struct connman_session_policy *policy)
remove_policy(policy);
}
-int connman_session_set_default_config(struct connman_session_config *config)
+void connman_session_set_default_config(struct connman_session_config *config)
{
config->priority = FALSE;
config->roaming_policy = CONNMAN_SESSION_ROAMING_POLICY_DEFAULT;
@@ -420,24 +420,14 @@ int connman_session_set_default_config(struct connman_session_config *config)
g_slist_free(config->allowed_bearers);
config->allowed_bearers = g_slist_prepend(NULL,
GINT_TO_POINTER(CONNMAN_SERVICE_TYPE_UNKNOWN));
- if (config->allowed_bearers == NULL)
- return -ENOMEM;
-
- return 0;
}
struct connman_session_config *connman_session_create_default_config(void)
{
struct connman_session_config *config;
- config = g_try_new0(struct connman_session_config, 1);
- if (config == NULL)
- return NULL;
-
- if (connman_session_set_default_config(config) < 0) {
- g_free(config);
- return NULL;
- }
+ config = g_new0(struct connman_session_config, 1);
+ connman_session_set_default_config(config);
return config;
}