chiark / gitweb /
treewide: simplify log_*_errno(r,...) immediately followed by "return r"
authorMichal Schmidt <mschmidt@redhat.com>
Fri, 28 Nov 2014 16:34:26 +0000 (17:34 +0100)
committerMichal Schmidt <mschmidt@redhat.com>
Fri, 28 Nov 2014 16:34:26 +0000 (17:34 +0100)
src/activate/activate.c
src/console/consoled-manager.c
src/core/manager.c
src/journal-remote/journal-remote.c
src/journal-remote/journal-upload-journal.c
src/journal-remote/journal-upload.c
src/journal/catalog.c
src/libsystemd-terminal/idev-keyboard.c
src/libsystemd-terminal/sysview.c
src/network/networkd-address.c

index 874b8836177f542908de1c09ccc2e5d93b2fca6a..a17babe076d9a699f02c9c9beea7512d68678f4f 100644 (file)
@@ -65,10 +65,8 @@ static int open_sockets(int *epoll_fd, bool accept) {
         int count = 0;
 
         n = sd_listen_fds(true);
-        if (n < 0) {
-                log_error_errno(n, "Failed to read listening file descriptors from environment: %m");
-                return n;
-        }
+        if (n < 0)
+                return log_error_errno(n, "Failed to read listening file descriptors from environment: %m");
         if (n > 0) {
                 log_info("Received %i descriptors via the environment.", n);
 
index 0eac7ae78ac17b3ccea6e71d8ae052b543da9f5b..9dd62f04a09d83c4b741ba0350805f09882195c9 100644 (file)
@@ -141,11 +141,9 @@ static int manager_sysview_session_add(Manager *m, sysview_event *event) {
         int r;
 
         r = sysview_session_take_control(session);
-        if (r < 0) {
-                log_error_errno(r, "Cannot request session control on '%s': %m",
-                                sysview_session_get_name(session));
-                return r;
-        }
+        if (r < 0)
+                return log_error_errno(r, "Cannot request session control on '%s': %m",
+                                       sysview_session_get_name(session));
 
         r = session_new(&s, m, session);
         if (r < 0) {
index c56c1621b06fa89c43830981ab66c749d5401cc7..f934594480f11cdb7e3dedfca7e1503d7ec67837 100644 (file)
@@ -729,10 +729,8 @@ static int manager_setup_kdbus(Manager *m) {
                         m->running_as == SYSTEMD_SYSTEM ? "system" : "user",
                         m->running_as == SYSTEMD_SYSTEM, &p);
 
-        if (m->kdbus_fd < 0) {
-                log_debug_errno(m->kdbus_fd, "Failed to set up kdbus: %m");
-                return m->kdbus_fd;
-        }
+        if (m->kdbus_fd < 0)
+                return log_debug_errno(m->kdbus_fd, "Failed to set up kdbus: %m");
 
         log_debug("Successfully set up kdbus on %s", p);
 #endif
index d1df83fba09c10867bfa834d3d8d7018bda6c680..21309743fe108cf12f40bb44e020055f28652916 100644 (file)
@@ -320,11 +320,9 @@ static int get_source_for_fd(RemoteServer *s,
                 return log_oom();
 
         r = get_writer(s, name, &writer);
-        if (r < 0) {
-                log_warning_errno(r, "Failed to get writer for source %s: %m",
-                                  name);
-                return r;
-        }
+        if (r < 0)
+                return log_warning_errno(r, "Failed to get writer for source %s: %m",
+                                         name);
 
         if (s->sources[fd] == NULL) {
                 s->sources[fd] = source_new(fd, false, name, writer);
@@ -459,11 +457,9 @@ static int request_meta(void **connection_cls, int fd, char *hostname) {
                 return 0;
 
         r = get_writer(server, hostname, &writer);
-        if (r < 0) {
-                log_warning_errno(r, "Failed to get writer for source %s: %m",
-                                  hostname);
-                return r;
-        }
+        if (r < 0)
+                return log_warning_errno(r, "Failed to get writer for source %s: %m",
+                                         hostname);
 
         source = source_new(fd, true, hostname, writer);
         if (!source) {
@@ -855,10 +851,9 @@ static int remoteserver_init(RemoteServer *s,
                 return r;
 
         n = sd_listen_fds(true);
-        if (n < 0) {
-                log_error_errno(n, "Failed to read listening file descriptors from environment: %m");
-                return n;
-        } else
+        if (n < 0)
+                return log_error_errno(n, "Failed to read listening file descriptors from environment: %m");
+        else
                 log_info("Received %d descriptors", n);
 
         if (MAX(http_socket, https_socket) >= SD_LISTEN_FDS_START + n) {
@@ -1460,28 +1455,22 @@ static int load_certificates(char **key, char **cert, char **trust) {
         int r;
 
         r = read_full_file(arg_key ?: PRIV_KEY_FILE, key, NULL);
-        if (r < 0) {
-                log_error_errno(r, "Failed to read key from file '%s': %m",
-                                arg_key ?: PRIV_KEY_FILE);
-                return r;
-        }
+        if (r < 0)
+                return log_error_errno(r, "Failed to read key from file '%s': %m",
+                                       arg_key ?: PRIV_KEY_FILE);
 
         r = read_full_file(arg_cert ?: CERT_FILE, cert, NULL);
-        if (r < 0) {
-                log_error_errno(r, "Failed to read certificate from file '%s': %m",
-                                arg_cert ?: CERT_FILE);
-                return r;
-        }
+        if (r < 0)
+                return log_error_errno(r, "Failed to read certificate from file '%s': %m",
+                                       arg_cert ?: CERT_FILE);
 
         if (arg_trust_all)
                 log_info("Certificate checking disabled.");
         else {
                 r = read_full_file(arg_trust ?: TRUST_FILE, trust, NULL);
-                if (r < 0) {
-                        log_error_errno(r, "Failed to read CA certificate file '%s': %m",
-                                        arg_trust ?: TRUST_FILE);
-                        return r;
-                }
+                if (r < 0)
+                        return log_error_errno(r, "Failed to read CA certificate file '%s': %m",
+                                               arg_trust ?: TRUST_FILE);
         }
 
         return 0;
index 6e5e45f7c97a0eb19dab9581a8526254926a78bb..942320cbf63c061d976a89ab8f8ca38f7dd76956 100644 (file)
@@ -25,10 +25,8 @@ static ssize_t write_entry(char *buf, size_t size, Uploader *u) {
                         u->current_cursor = NULL;
 
                         r = sd_journal_get_cursor(u->journal, &u->current_cursor);
-                        if (r < 0) {
-                                log_error_errno(r, "Failed to get cursor: %m");
-                                return r;
-                        }
+                        if (r < 0)
+                                return log_error_errno(r, "Failed to get cursor: %m");
 
                         r = snprintf(buf + pos, size - pos,
                                      "__CURSOR=%s\n", u->current_cursor);
@@ -51,10 +49,8 @@ static ssize_t write_entry(char *buf, size_t size, Uploader *u) {
                         usec_t realtime;
 
                         r = sd_journal_get_realtime_usec(u->journal, &realtime);
-                        if (r < 0) {
-                                log_error_errno(r, "Failed to get realtime timestamp: %m");
-                                return r;
-                        }
+                        if (r < 0)
+                                return log_error_errno(r, "Failed to get realtime timestamp: %m");
 
                         r = snprintf(buf + pos, size - pos,
                                      "__REALTIME_TIMESTAMP="USEC_FMT"\n", realtime);
@@ -78,10 +74,8 @@ static ssize_t write_entry(char *buf, size_t size, Uploader *u) {
                         sd_id128_t boot_id;
 
                         r = sd_journal_get_monotonic_usec(u->journal, &monotonic, &boot_id);
-                        if (r < 0) {
-                                log_error_errno(r, "Failed to get monotonic timestamp: %m");
-                                return r;
-                        }
+                        if (r < 0)
+                                return log_error_errno(r, "Failed to get monotonic timestamp: %m");
 
                         r = snprintf(buf + pos, size - pos,
                                      "__MONOTONIC_TIMESTAMP="USEC_FMT"\n", monotonic);
@@ -105,10 +99,8 @@ static ssize_t write_entry(char *buf, size_t size, Uploader *u) {
                         char sid[33];
 
                         r = sd_journal_get_monotonic_usec(u->journal, NULL, &boot_id);
-                        if (r < 0) {
-                                log_error_errno(r, "Failed to get monotonic timestamp: %m");
-                                return r;
-                        }
+                        if (r < 0)
+                                return log_error_errno(r, "Failed to get monotonic timestamp: %m");
 
                         r = snprintf(buf + pos, size - pos,
                                      "_BOOT_ID=%s\n", sd_id128_to_string(boot_id, sid));
@@ -133,10 +125,9 @@ static ssize_t write_entry(char *buf, size_t size, Uploader *u) {
                         r = sd_journal_enumerate_data(u->journal,
                                                       &u->field_data,
                                                       &u->field_length);
-                        if (r < 0) {
-                                log_error_errno(r, "Failed to move to next field in entry: %m");
-                                return r;
-                        } else if (r == 0) {
+                        if (r < 0)
+                                return log_error_errno(r, "Failed to move to next field in entry: %m");
+                        else if (r == 0) {
                                 u->entry_state = ENTRY_OUTRO;
                                 continue;
                         }
@@ -302,10 +293,9 @@ static int process_journal_input(Uploader *u, int skip) {
         int r;
 
         r = sd_journal_next_skip(u->journal, skip);
-        if (r < 0) {
-                log_error_errno(r, "Failed to skip to next entry: %m");
-                return r;
-        } else if (r < skip)
+        if (r < 0)
+                return log_error_errno(r, "Failed to skip to next entry: %m");
+        else if (r < skip)
                 return 0;
 
         /* have data */
@@ -361,10 +351,8 @@ int open_journal_for_upload(Uploader *u,
 
         if (follow) {
                 fd = sd_journal_get_fd(j);
-                if (fd < 0) {
-                        log_error_errno(fd, "sd_journal_get_fd failed: %m");
-                        return fd;
-                }
+                if (fd < 0)
+                        return log_error_errno(fd, "sd_journal_get_fd failed: %m");
 
                 events = sd_journal_get_events(j);
 
@@ -377,10 +365,8 @@ int open_journal_for_upload(Uploader *u,
 
                 r = sd_event_add_io(u->events, &u->input_event,
                                     fd, events, dispatch_journal_input, u);
-                if (r < 0) {
-                        log_error_errno(r, "Failed to register input event: %m");
-                        return r;
-                }
+                if (r < 0)
+                        return log_error_errno(r, "Failed to register input event: %m");
 
                 log_debug("Listening for journal events on fd:%d, timeout %d",
                           fd, u->timeout == (uint64_t) -1 ? -1 : (int) u->timeout);
@@ -390,9 +376,8 @@ int open_journal_for_upload(Uploader *u,
         if (cursor) {
                 r = sd_journal_seek_cursor(j, cursor);
                 if (r < 0) {
-                        log_error_errno(r, "Failed to seek to cursor %s: %m",
-                                        cursor);
-                        return r;
+                        return log_error_errno(r, "Failed to seek to cursor %s: %m",
+                                               cursor);
                 }
         }
 
index e677e133488adc22cf984bb8e30463950aa9cedf..8da65132ca28af3853d6bf127b221a24260e44b3 100644 (file)
@@ -103,18 +103,14 @@ static int check_cursor_updating(Uploader *u) {
                 return 0;
 
         r = mkdir_parents(u->state_file, 0755);
-        if (r < 0) {
-                log_error_errno(r, "Cannot create parent directory of state file %s: %m",
-                                u->state_file);
-                return r;
-        }
+        if (r < 0)
+                return log_error_errno(r, "Cannot create parent directory of state file %s: %m",
+                                       u->state_file);
 
         r = fopen_temporary(u->state_file, &f, &temp_path);
-        if (r < 0) {
-                log_error_errno(r, "Cannot save state to %s: %m",
-                                u->state_file);
-                return r;
-        }
+        if (r < 0)
+                return log_error_errno(r, "Cannot save state to %s: %m",
+                                       u->state_file);
         unlink(temp_path);
 
         return 0;
@@ -164,11 +160,10 @@ static int load_cursor_state(Uploader *u) {
 
         if (r == -ENOENT)
                 log_debug("State file %s is not present.", u->state_file);
-        else if (r < 0) {
-                log_error_errno(r, "Failed to read state file %s: %m",
-                                u->state_file);
-                return r;
-        } else
+        else if (r < 0)
+                return log_error_errno(r, "Failed to read state file %s: %m",
+                                       u->state_file);
+        else
                 log_debug("Last cursor was %s", u->last_cursor);
 
         return 0;
@@ -374,10 +369,8 @@ static int open_file_for_upload(Uploader *u, const char *filename) {
                 r = sd_event_add_io(u->events, &u->input_event,
                                     fd, EPOLLIN, dispatch_fd_input, u);
                 if (r < 0) {
-                        if (r != -EPERM || arg_follow > 0) {
-                                log_error_errno(r, "Failed to register input event: %m");
-                                return r;
-                        }
+                        if (r != -EPERM || arg_follow > 0)
+                                return log_error_errno(r, "Failed to register input event: %m");
 
                         /* Normal files should just be consumed without polling. */
                         r = start_upload(u, fd_input_callback, u);
@@ -458,16 +451,12 @@ static int setup_uploader(Uploader *u, const char *url, const char *state_file)
         u->state_file = state_file;
 
         r = sd_event_default(&u->events);
-        if (r < 0) {
-                log_error_errno(r, "sd_event_default failed: %m");
-                return r;
-        }
+        if (r < 0)
+                return log_error_errno(r, "sd_event_default failed: %m");
 
         r = setup_signals(u);
-        if (r < 0) {
-                log_error_errno(r, "Failed to set up signals: %m");
-                return r;
-        }
+        if (r < 0)
+                return log_error_errno(r, "Failed to set up signals: %m");
 
         return load_cursor_state(u);
 }
@@ -701,10 +690,8 @@ static int parse_argv(int argc, char *argv[]) {
 
                 case ARG_FILE:
                         r = glob_extend(&arg_file, optarg);
-                        if (r < 0) {
-                                log_error_errno(r, "Failed to add paths: %m");
-                                return r;
-                        };
+                        if (r < 0)
+                                return log_error_errno(r, "Failed to add paths: %m");
                         break;
 
                 case ARG_CURSOR:
index 67bf4ba017f3be7e319816f2392cf981b6d7a167..03dddb48a55d86469880eaef9d150440289fca17 100644 (file)
@@ -341,17 +341,13 @@ static long write_catalog(const char *database, Hashmap *h, struct strbuf *sb,
                 return log_oom();
 
         r = mkdir_p(d, 0775);
-        if (r < 0) {
-                log_error_errno(r, "Recursive mkdir %s: %m", d);
-                return r;
-        }
+        if (r < 0)
+                return log_error_errno(r, "Recursive mkdir %s: %m", d);
 
         r = fopen_temporary(database, &w, &p);
-        if (r < 0) {
-                log_error_errno(r, "Failed to open database for writing: %s: %m",
-                                database);
-                return r;
-        }
+        if (r < 0)
+                return log_error_errno(r, "Failed to open database for writing: %s: %m",
+                                       database);
 
         zero(header);
         memcpy(header.signature, CATALOG_SIGNATURE, sizeof(header.signature));
index e971ab360deb924edfe02315970af6024f98315a..bcb2a4b1e239140d3798e2499225f35f3411f9ce 100644 (file)
@@ -332,10 +332,8 @@ static int kbdctx_refresh_keymap(kbdctx *kc) {
         /* TODO: add a fallback keymap that's compiled-in */
         r = kbdmap_new_from_names(&km, kc, kc->last_x11_model, kc->last_x11_layout,
                                   kc->last_x11_variant, kc->last_x11_options);
-        if (r < 0) {
-                log_debug_errno(r, "idev-keyboard: cannot create keymap from locale1: %m");
-                return r;
-        }
+        if (r < 0)
+                return log_debug_errno(r, "idev-keyboard: cannot create keymap from locale1: %m");
 
         kbdmap_unref(kc->kbdmap);
         kc->kbdmap = km;
@@ -1161,9 +1159,8 @@ static int keyboard_update_kbdtbl(idev_keyboard *k) {
         return 0;
 
 error:
-        log_debug_errno(r, "idev-keyboard: %s/%s: cannot adopt new compose table: %m",
-                        d->session->name, d->name);
-        return r;
+        return log_debug_errno(r, "idev-keyboard: %s/%s: cannot adopt new compose table: %m",
+                               d->session->name, d->name);
 }
 
 static const idev_device_vtable keyboard_vtable = {
index 62d9b6606091e7f14bf645be4061b4b5f339abb7..9ee32db1bc2ab08f07f7fbb0f8a90664454d0030 100644 (file)
@@ -975,11 +975,9 @@ static int context_ud_hotplug(sysview_context *c, struct udev_device *d) {
                         return 0;
 
                 r = device_new_ud(&device, seat, type, d);
-                if (r < 0) {
-                        log_debug_errno(r, "sysview: cannot create device for udev-device '%s': %m",
-                                        syspath);
-                        return r;
-                }
+                if (r < 0)
+                        return log_debug_errno(r, "sysview: cannot create device for udev-device '%s': %m",
+                                               syspath);
 
                 context_add_device(c, device);
         }
@@ -1102,10 +1100,8 @@ static int context_ld_seat_new(sysview_context *c, sd_bus_message *signal) {
         int r;
 
         r = sd_bus_message_read(signal, "so", &id, &path);
-        if (r < 0) {
-                log_debug_errno(r, "sysview: cannot parse SeatNew from logind: %m");
-                return r;
-        }
+        if (r < 0)
+                return log_debug_errno(r, "sysview: cannot parse SeatNew from logind: %m");
 
         context_add_seat(c, id);
         return 0;
@@ -1117,10 +1113,8 @@ static int context_ld_seat_removed(sysview_context *c, sd_bus_message *signal) {
         int r;
 
         r = sd_bus_message_read(signal, "so", &id, &path);
-        if (r < 0) {
-                log_debug_errno(r, "sysview: cannot parse SeatRemoved from logind: %m");
-                return r;
-        }
+        if (r < 0)
+                return log_debug_errno(r, "sysview: cannot parse SeatRemoved from logind: %m");
 
         seat = sysview_find_seat(c, id);
         if (!seat)
@@ -1138,10 +1132,8 @@ static int context_ld_session_new(sysview_context *c, sd_bus_message *signal) {
         int r;
 
         r = sd_bus_message_read(signal, "so", &id, &path);
-        if (r < 0) {
-                log_debug_errno(r, "sysview: cannot parse SessionNew from logind: %m");
-                return r;
-        }
+        if (r < 0)
+                return log_debug_errno(r, "sysview: cannot parse SessionNew from logind: %m");
 
         /*
          * As the dbus message didn't contain enough information, we
@@ -1182,9 +1174,8 @@ static int context_ld_session_new(sysview_context *c, sd_bus_message *signal) {
         return 0;
 
 error:
-        log_debug_errno(r, "sysview: failed retrieving information for new session '%s': %m",
-                        id);
-        return r;
+        return log_debug_errno(r, "sysview: failed retrieving information for new session '%s': %m",
+                               id);
 }
 
 static int context_ld_session_removed(sysview_context *c, sd_bus_message *signal) {
@@ -1193,10 +1184,8 @@ static int context_ld_session_removed(sysview_context *c, sd_bus_message *signal
         int r;
 
         r = sd_bus_message_read(signal, "so", &id, &path);
-        if (r < 0) {
-                log_debug_errno(r, "sysview: cannot parse SessionRemoved from logind: %m");
-                return r;
-        }
+        if (r < 0)
+                return log_debug_errno(r, "sysview: cannot parse SessionRemoved from logind: %m");
 
         session = sysview_find_session(c, id);
         if (!session)
@@ -1295,8 +1284,7 @@ static int context_ld_list_seats_fn(sd_bus *bus,
         return 0;
 
 error:
-        log_debug_errno(r, "sysview: erroneous ListSeats response from logind: %m");
-        return r;
+        return log_debug_errno(r, "sysview: erroneous ListSeats response from logind: %m");
 }
 
 static int context_ld_list_sessions_fn(sd_bus *bus,
@@ -1360,8 +1348,7 @@ static int context_ld_list_sessions_fn(sd_bus *bus,
         return 0;
 
 error:
-        log_debug_errno(r, "sysview: erroneous ListSessions response from logind: %m");
-        return r;
+        return log_debug_errno(r, "sysview: erroneous ListSessions response from logind: %m");
 }
 
 static int context_ld_scan(sysview_context *c) {
@@ -1491,19 +1478,15 @@ static int context_scan_fn(sd_event_source *s, void *userdata) {
 
         if (!c->scanned) {
                 r = context_ld_scan(c);
-                if (r < 0) {
-                        log_debug_errno(r, "sysview: logind scan failed: %m");
-                        return r;
-                }
+                if (r < 0)
+                        return log_debug_errno(r, "sysview: logind scan failed: %m");
         }
 
         /* skip device scans if no sessions are available */
         if (hashmap_size(c->session_map) > 0) {
                 r = context_ud_scan(c);
-                if (r < 0) {
-                        log_debug_errno(r, "sysview: udev scan failed: %m");
-                        return r;
-                }
+                if (r < 0)
+                        return log_debug_errno(r, "sysview: udev scan failed: %m");
 
                 HASHMAP_FOREACH(seat, c->seat_map, i)
                         seat->scanned = true;
index 9502fa8caae412a754f87e931b577b2e8b00ffcc..a85e8fa21ec168c0fa535473551a66d2f4ffe652 100644 (file)
@@ -117,31 +117,23 @@ int address_drop(Address *address, Link *link,
 
         r = sd_rtnl_message_new_addr(link->manager->rtnl, &req, RTM_DELADDR,
                                      link->ifindex, address->family);
-        if (r < 0) {
-                log_error_errno(r, "Could not allocate RTM_DELADDR message: %m");
-                return r;
-        }
+        if (r < 0)
+                return log_error_errno(r, "Could not allocate RTM_DELADDR message: %m");
 
         r = sd_rtnl_message_addr_set_prefixlen(req, address->prefixlen);
-        if (r < 0) {
-                log_error_errno(r, "Could not set prefixlen: %m");
-                return r;
-        }
+        if (r < 0)
+                return log_error_errno(r, "Could not set prefixlen: %m");
 
         if (address->family == AF_INET)
                 r = sd_rtnl_message_append_in_addr(req, IFA_LOCAL, &address->in_addr.in);
         else if (address->family == AF_INET6)
                 r = sd_rtnl_message_append_in6_addr(req, IFA_LOCAL, &address->in_addr.in6);
-        if (r < 0) {
-                log_error_errno(r, "Could not append IFA_LOCAL attribute: %m");
-                return r;
-        }
+        if (r < 0)
+                return log_error_errno(r, "Could not append IFA_LOCAL attribute: %m");
 
         r = sd_rtnl_call_async(link->manager->rtnl, req, callback, link, 0, NULL);
-        if (r < 0) {
-                log_error_errno(r, "Could not send rtnetlink message: %m");
-                return r;
-        }
+        if (r < 0)
+                return log_error_errno(r, "Could not send rtnetlink message: %m");
 
         link_ref(link);
 
@@ -161,65 +153,47 @@ int address_update(Address *address, Link *link,
 
         r = sd_rtnl_message_new_addr_update(link->manager->rtnl, &req,
                                      link->ifindex, address->family);
-        if (r < 0) {
-                log_error_errno(r, "Could not allocate RTM_NEWADDR message: %m");
-                return r;
-        }
+        if (r < 0)
+                return log_error_errno(r, "Could not allocate RTM_NEWADDR message: %m");
 
         r = sd_rtnl_message_addr_set_prefixlen(req, address->prefixlen);
-        if (r < 0) {
-                log_error_errno(r, "Could not set prefixlen: %m");
-                return r;
-        }
+        if (r < 0)
+                return log_error_errno(r, "Could not set prefixlen: %m");
 
         r = sd_rtnl_message_addr_set_flags(req, IFA_F_PERMANENT);
-        if (r < 0) {
-                log_error_errno(r, "Could not set flags: %m");
-                return r;
-        }
+        if (r < 0)
+                return log_error_errno(r, "Could not set flags: %m");
 
         r = sd_rtnl_message_addr_set_scope(req, address->scope);
-        if (r < 0) {
-                log_error_errno(r, "Could not set scope: %m");
-                return r;
-        }
+        if (r < 0)
+                return log_error_errno(r, "Could not set scope: %m");
 
         if (address->family == AF_INET)
                 r = sd_rtnl_message_append_in_addr(req, IFA_LOCAL, &address->in_addr.in);
         else if (address->family == AF_INET6)
                 r = sd_rtnl_message_append_in6_addr(req, IFA_LOCAL, &address->in_addr.in6);
-        if (r < 0) {
-                log_error_errno(r, "Could not append IFA_LOCAL attribute: %m");
-                return r;
-        }
+        if (r < 0)
+                return log_error_errno(r, "Could not append IFA_LOCAL attribute: %m");
 
         if (address->family == AF_INET) {
                 r = sd_rtnl_message_append_in_addr(req, IFA_BROADCAST, &address->broadcast);
-                if (r < 0) {
-                        log_error_errno(r, "Could not append IFA_BROADCAST attribute: %m");
-                        return r;
-                }
+                if (r < 0)
+                        return log_error_errno(r, "Could not append IFA_BROADCAST attribute: %m");
         }
 
         if (address->label) {
                 r = sd_rtnl_message_append_string(req, IFA_LABEL, address->label);
-                if (r < 0) {
-                        log_error_errno(r, "Could not append IFA_LABEL attribute: %m");
-                        return r;
-                }
+                if (r < 0)
+                        return log_error_errno(r, "Could not append IFA_LABEL attribute: %m");
         }
 
         r = sd_rtnl_message_append_cache_info(req, IFA_CACHEINFO, &address->cinfo);
-        if (r < 0) {
-                log_error_errno(r, "Could not append IFA_CACHEINFO attribute: %m");
-                return r;
-        }
+        if (r < 0)
+                return log_error_errno(r, "Could not append IFA_CACHEINFO attribute: %m");
 
         r = sd_rtnl_call_async(link->manager->rtnl, req, callback, link, 0, NULL);
-        if (r < 0) {
-                log_error_errno(r, "Could not send rtnetlink message: %m");
-                return r;
-        }
+        if (r < 0)
+                return log_error_errno(r, "Could not send rtnetlink message: %m");
 
         link_ref(link);
 
@@ -305,77 +279,57 @@ int address_configure(Address *address, Link *link,
 
         r = sd_rtnl_message_new_addr(link->manager->rtnl, &req, RTM_NEWADDR,
                                      link->ifindex, address->family);
-        if (r < 0) {
-                log_error_errno(r, "Could not allocate RTM_NEWADDR message: %m");
-                return r;
-        }
+        if (r < 0)
+                return log_error_errno(r, "Could not allocate RTM_NEWADDR message: %m");
 
         r = sd_rtnl_message_addr_set_prefixlen(req, address->prefixlen);
-        if (r < 0) {
-                log_error_errno(r, "Could not set prefixlen: %m");
-                return r;
-        }
+        if (r < 0)
+                return log_error_errno(r, "Could not set prefixlen: %m");
 
         r = sd_rtnl_message_addr_set_flags(req, IFA_F_PERMANENT);
-        if (r < 0) {
-                log_error_errno(r, "Could not set flags: %m");
-                return r;
-        }
+        if (r < 0)
+                return log_error_errno(r, "Could not set flags: %m");
 
         r = sd_rtnl_message_addr_set_scope(req, address->scope);
-        if (r < 0) {
-                log_error_errno(r, "Could not set scope: %m");
-                return r;
-        }
+        if (r < 0)
+                return log_error_errno(r, "Could not set scope: %m");
 
         if (address->family == AF_INET)
                 r = sd_rtnl_message_append_in_addr(req, IFA_LOCAL, &address->in_addr.in);
         else if (address->family == AF_INET6)
                 r = sd_rtnl_message_append_in6_addr(req, IFA_LOCAL, &address->in_addr.in6);
-        if (r < 0) {
-                log_error_errno(r, "Could not append IFA_LOCAL attribute: %m");
-                return r;
-        }
+        if (r < 0)
+                return log_error_errno(r, "Could not append IFA_LOCAL attribute: %m");
 
         if (!in_addr_is_null(address->family, &address->in_addr_peer)) {
                 if (address->family == AF_INET)
                         r = sd_rtnl_message_append_in_addr(req, IFA_ADDRESS, &address->in_addr_peer.in);
                 else if (address->family == AF_INET6)
                         r = sd_rtnl_message_append_in6_addr(req, IFA_ADDRESS, &address->in_addr_peer.in6);
-                if (r < 0) {
-                        log_error_errno(r, "Could not append IFA_ADDRESS attribute: %m");
-                        return r;
-                }
+                if (r < 0)
+                        return log_error_errno(r, "Could not append IFA_ADDRESS attribute: %m");
         } else {
                 if (address->family == AF_INET) {
                         r = sd_rtnl_message_append_in_addr(req, IFA_BROADCAST, &address->broadcast);
-                        if (r < 0) {
-                                log_error_errno(r, "Could not append IFA_BROADCAST attribute: %m");
-                                return r;
-                        }
+                        if (r < 0)
+                                return log_error_errno(r, "Could not append IFA_BROADCAST attribute: %m");
                 }
         }
 
         if (address->label) {
                 r = sd_rtnl_message_append_string(req, IFA_LABEL, address->label);
-                if (r < 0) {
-                        log_error_errno(r, "Could not append IFA_LABEL attribute: %m");
-                        return r;
-                }
+                if (r < 0)
+                        return log_error_errno(r, "Could not append IFA_LABEL attribute: %m");
         }
 
         r = sd_rtnl_message_append_cache_info(req, IFA_CACHEINFO,
                                               &address->cinfo);
-        if (r < 0) {
-                log_error_errno(r, "Could not append IFA_CACHEINFO attribute: %m");
-                return r;
-        }
+        if (r < 0)
+                return log_error_errno(r, "Could not append IFA_CACHEINFO attribute: %m");
 
         r = sd_rtnl_call_async(link->manager->rtnl, req, callback, link, 0, NULL);
-        if (r < 0) {
-                log_error_errno(r, "Could not send rtnetlink message: %m");
-                return r;
-        }
+        if (r < 0)
+                return log_error_errno(r, "Could not send rtnetlink message: %m");
 
         link_ref(link);