Skip to contentSkip to conversation

obexd/session: Do not check session->driver->uuid in get_target()

PATCH In review [email protected] 2 participants 2 messages Jul 17, 2013 Bluetooth drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 obexd/session: Do not check session->driver->uuid in get_target()

From: Martin Xu <[email protected]>

since it already be checked at target_exists(), so if session->driver->uuid is NULL get_target() should not be called.

---
 obexd/client/session.c |    3 ---
 1 file changed, 3 deletions(-)
obexd/client/session.c +0 -3
index 44e2bf8..361c921 100644
@@ -680,9 +680,6 @@ static gboolean get_target(const GDBusPropertyTable *property,
 {
 	struct obc_session *session = data;
 
-	if (session->driver->uuid == NULL)
-		return FALSE;
-
 	dbus_message_iter_append_basic(iter, DBUS_TYPE_STRING,
 						&session->driver->uuid);
 
Signature · 1 line
1.7.10.4
#1 lore raw

Hi Martin,

Quoted 23 lines · On Wed, Jul 17, 2013 at 6:15 AM, <[email protected]> wrote:

From: Martin Xu <[email protected]>

since it already be checked at target_exists(), so if session->driver->uuid is NULL get_target() should not be called.

---
 obexd/client/session.c |    3 ---
 1 file changed, 3 deletions(-)
obexd/client/session.c +0 -4
index 44e2bf8..361c921 100644
@@ -680,9 +680,6 @@ static gboolean get_target(const GDBusPropertyTable *property,
 {
        struct obc_session *session = data;
 
-       if (session->driver->uuid == NULL)
-               return FALSE;
-
        dbus_message_iter_append_basic(iter, DBUS_TYPE_STRING,
                                                &session->driver->uuid);
 
--
Quoted 1 line

1.7.10.4

This is used as a safe guard to avoid any chance that NULL is passed to dbus_message_iter_append_basic in case get_target is called from another context, it isn't the case here but it is consistent with other parts of the code.

--
Luiz Augusto von Dentz