[PATCH v0 7/7] bluetooth: Simplify redundant error check

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

 



From: Mikel Astiz <mikel.astiz@xxxxxxxxxxxx>

As pointed out by Tanu, checking both error conditions is redundant and
raises the question whether it's possible that one of the conditions is
true while the other is false.

Therefore, simplify the condition by just checking one part of the
disjunction.
---
 src/modules/bluetooth/bluetooth-util.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/src/modules/bluetooth/bluetooth-util.c b/src/modules/bluetooth/bluetooth-util.c
index 48e12da..d78505f 100644
--- a/src/modules/bluetooth/bluetooth-util.c
+++ b/src/modules/bluetooth/bluetooth-util.c
@@ -1129,7 +1129,7 @@ int pa_bluetooth_transport_acquire(pa_bluetooth_transport *t, bool optional, siz
     pa_assert_se(dbus_message_append_args(m, DBUS_TYPE_STRING, &accesstype, DBUS_TYPE_INVALID));
     r = dbus_connection_send_with_reply_and_block(pa_dbus_connection_get(t->device->discovery->connection), m, -1, &err);
 
-    if (dbus_error_is_set(&err) || !r) {
+    if (!r) {
         dbus_error_free(&err);
         return -1;
     }
@@ -1220,9 +1220,7 @@ static int setup_dbus(pa_bluetooth_discovery *y) {
 
     dbus_error_init(&err);
 
-    y->connection = pa_dbus_bus_get(y->core, DBUS_BUS_SYSTEM, &err);
-
-    if (dbus_error_is_set(&err) || !y->connection) {
+    if (!(y->connection = pa_dbus_bus_get(y->core, DBUS_BUS_SYSTEM, &err))) {
         pa_log("Failed to get D-Bus connection: %s", err.message);
         dbus_error_free(&err);
         return -1;
-- 
1.7.11.7



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

  Powered by Linux