[RFCv3 20/43] FIXUP: Change parse_device_property() to return void

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Jo?o Paulo Rechi Vita <jprvita@xxxxxxxxxxxxx>

---
 src/modules/bluetooth/bluez5-util.c | 29 +++++++++++------------------
 1 file changed, 11 insertions(+), 18 deletions(-)

diff --git a/src/modules/bluetooth/bluez5-util.c b/src/modules/bluetooth/bluez5-util.c
index 8f682c6..49d5c38 100644
--- a/src/modules/bluetooth/bluez5-util.c
+++ b/src/modules/bluetooth/bluez5-util.c
@@ -412,7 +412,7 @@ static void adapter_remove_all(pa_bluetooth_discovery *y) {
     }
 }
 
-static int parse_device_property(pa_bluetooth_device *d, DBusMessageIter *i, bool is_property_change) {
+static void parse_device_property(pa_bluetooth_device *d, DBusMessageIter *i, bool is_property_change) {
     const char *key;
     DBusMessageIter variant_i;
 
@@ -421,7 +421,7 @@ static int parse_device_property(pa_bluetooth_device *d, DBusMessageIter *i, boo
     key = check_variant_property(i);
     if (key == NULL) {
         pa_log_error("Received invalid property for device %s", d->path);
-        return -1;
+        return;
     }
 
     dbus_message_iter_recurse(i, &variant_i);
@@ -438,13 +438,13 @@ static int parse_device_property(pa_bluetooth_device *d, DBusMessageIter *i, boo
                 pa_log_debug("%s: %s", key, value);
             } else if (pa_streq(key, "Address")) {
                 if (is_property_change) {
-                    pa_log_error("Device property 'Address' expected to be constant but changed for %s", d->path);
-                    return -1;
+                    pa_log_warn("Device property 'Address' expected to be constant but changed for %s, ignoring", d->path);
+                    return;
                 }
 
                 if (d->address) {
-                    pa_log_error("Device %s: Received a duplicate 'Address' property.", d->path);
-                    return -1;
+                    pa_log_warn("Device %s: Received a duplicate 'Address' property, ignoring", d->path);
+                    return;
                 }
 
                 d->address = pa_xstrdup(value);
@@ -461,13 +461,13 @@ static int parse_device_property(pa_bluetooth_device *d, DBusMessageIter *i, boo
             if (pa_streq(key, "Adapter")) {
 
                 if (is_property_change) {
-                    pa_log_error("Device property 'Adapter' expected to be constant but changed for %s", d->path);
-                    return -1;
+                    pa_log_warn("Device property 'Adapter' expected to be constant but changed for %s, ignoring", d->path);
+                    return;
                 }
 
                 if (d->adapter) {
-                    pa_log_error("Device %s: Received a duplicate 'Adapter' property.", d->path);
-                    return -1;
+                    pa_log_warn("Device %s: Received a duplicate 'Adapter' property, ignoring", d->path);
+                    return;
                 }
 
                 d->adapter = pa_hashmap_get(d->discovery->adapters, value);
@@ -524,8 +524,6 @@ static int parse_device_property(pa_bluetooth_device *d, DBusMessageIter *i, boo
             break;
         }
     }
-
-    return 0;
 }
 
 static int parse_device_properties(pa_bluetooth_device *d, DBusMessageIter *i, bool is_property_change) {
@@ -538,12 +536,7 @@ static int parse_device_properties(pa_bluetooth_device *d, DBusMessageIter *i, b
         DBusMessageIter dict_i;
 
         dbus_message_iter_recurse(&element_i, &dict_i);
-
-        if (parse_device_property(d, &dict_i, is_property_change) < 0) {
-            d->device_info_valid = -1;
-            ret = -1;
-        }
-
+        parse_device_property(d, &dict_i, is_property_change);
         dbus_message_iter_next(&element_i);
     }
 
-- 
1.8.3.1



[Index of Archives]     [Linux Audio Users]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux