From: Patrik Flykt <[email protected]>

Move bridge checking into set_tethering(), as the bridge
information is not used elsewhere.
---
 src/technology.c |   15 +++++++--------
 1 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/src/technology.c b/src/technology.c
index e408da4..9549a2b 100644
--- a/src/technology.c
+++ b/src/technology.c
@@ -170,9 +170,9 @@ void connman_technology_tethering_notify(struct 
connman_technology *technology,
 }
 
 static int set_tethering(struct connman_technology *technology,
-                               const char *bridge, connman_bool_t enabled)
+                               connman_bool_t enabled)
 {
-       const char *ident, *passphrase;
+       const char *ident, *passphrase, *bridge;
 
        ident = technology->tethering_ident;
        passphrase = technology->tethering_passphrase;
@@ -181,6 +181,10 @@ static int set_tethering(struct connman_technology 
*technology,
                        technology->driver->set_tethering == NULL)
                return -EOPNOTSUPP;
 
+       bridge = __connman_tethering_get_bridge();
+       if (bridge == NULL)
+               return -EOPNOTSUPP;
+
        if (technology->type == CONNMAN_SERVICE_TYPE_WIFI &&
            (ident == NULL || passphrase == NULL))
                return -EINVAL;
@@ -477,7 +481,6 @@ static DBusMessage *set_property(DBusConnection *conn,
        if (g_str_equal(name, "Tethering") == TRUE) {
                int err;
                connman_bool_t tethering;
-               const char *bridge;
 
                if (type != DBUS_TYPE_BOOLEAN)
                        return __connman_error_invalid_arguments(msg);
@@ -487,11 +490,7 @@ static DBusMessage *set_property(DBusConnection *conn,
                if (technology->tethering == tethering)
                        return __connman_error_in_progress(msg);
 
-               bridge = __connman_tethering_get_bridge();
-               if (bridge == NULL)
-                       return __connman_error_not_supported(msg);
-
-               err = set_tethering(technology, bridge, tethering);
+               err = set_tethering(technology, tethering);
                if (err < 0)
                        return __connman_error_failed(msg, -err);
 
-- 
1.7.2.5

_______________________________________________
connman mailing list
[email protected]
http://lists.connman.net/listinfo/connman

Reply via email to