summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@nokia.com>2006-10-12 07:57:31 +0000
committerJohan Hedberg <johan.hedberg@nokia.com>2006-10-12 07:57:31 +0000
commitdc98e542d99dfa603ba21d355d902da2409e7c29 (patch)
treecbe118ccaa1dafb383856b17200de1f5f5e78cc8
parentb86c496307b2b284fabb1a33490163a78aeeb831 (diff)
Clean up disc_device_remove
-rw-r--r--hcid/dbus.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/hcid/dbus.c b/hcid/dbus.c
index ba47af48..cc82731a 100644
--- a/hcid/dbus.c
+++ b/hcid/dbus.c
@@ -171,21 +171,19 @@ static int disc_device_remove(struct slist **list, bdaddr_t *bdaddr)
{
struct discovered_dev_info *dev, match;
struct slist *l;
- int ret_val = -1;
memset(&match, 0, sizeof(struct discovered_dev_info));
bacpy(&match.bdaddr, bdaddr);
l = slist_find(*list, &match, (cmp_func_t) disc_device_find);
+ if (!l)
+ return -1;
- if (l) {
- dev = l->data;
- *list = slist_remove(*list, dev);
- free(dev);
- ret_val = 0;
- }
+ dev = l->data;
+ *list = slist_remove(*list, dev);
+ free(dev);
- return ret_val;
+ return 0;
}
int active_conn_find_by_bdaddr(const void *data, const void *user_data)