diff --git a/config.c b/config.c
index 6fc840c..ce2ed47 100644
--- a/config.c
+++ b/config.c
@@ -47,9 +47,11 @@
 {
 	struct config_item *item;
 
-	for (item = config->items; item; item = item->next)
-		if (!strcasecmp(item->name, name))
+	for (item = config->items; item; item = item->next) {
+		if (!strcasecmp(item->name, name)) {
 			return item->value;
+		}
+	}
 
 	return NULL;
 }
@@ -65,12 +67,14 @@
 		int rc;
 
 		/* trim leading space */
-		for (; *line == ' ' || *line == '\t'; line++)
+		for (; *line == ' ' || *line == '\t'; line++) {
 			;
+		}
 
 		/* skip comments */
-		if (*line == '#')
+		if (*line == '#') {
 			continue;
+		}
 
 		name = malloc(strlen(line));
 		value = malloc(strlen(line));
@@ -139,8 +143,9 @@
 	struct config *config;
 	int fd;
 
-	if (!filename)
+	if (!filename) {
 		filename = config_default_filename;
+	}
 
 	fd = open(filename, O_RDONLY);
 	if (fd < 0) {
@@ -271,16 +276,19 @@
 	char *suffix;
 	size_t i;
 
-	if (!size_str)
+	if (!size_str) {
 		return -1;
+	}
 
 	logsize = strtoul(size_str, &suffix, 0);
-	if (logsize == 0 || logsize >= UINT32_MAX || suffix == size_str)
+	if (logsize == 0 || logsize >= UINT32_MAX || suffix == size_str) {
 		return -1;
+	}
 
 	/* Ignore spaces between number and suffix */
-	while (*suffix && isspace(*suffix))
+	while (*suffix && isspace(*suffix)) {
 		suffix++;
+	}
 
 	for (i = 0; i < num_suffixes; i++) {
 		if (*suffix == suffixes[i].unit) {
@@ -288,8 +296,9 @@
 			 * If logsize overflows, probably something was wrong.
 			 * Return instead of clamping to an arbitrary value.
 			 */
-			if (logsize > (UINT32_MAX >> suffixes[i].shiftwidth))
+			if (logsize > (UINT32_MAX >> suffixes[i].shiftwidth)) {
 				return -1;
+			}
 
 			logsize <<= suffixes[i].shiftwidth;
 			suffix++;
@@ -298,8 +307,9 @@
 	}
 
 	/* Allow suffix like 'kB' */
-	while (*suffix && (tolower(*suffix) == 'b' || isspace(*suffix)))
+	while (*suffix && (tolower(*suffix) == 'b' || isspace(*suffix))) {
 		suffix++;
+	}
 
 	if (*suffix) {
 		warn("Invalid suffix!");
diff --git a/console-client.c b/console-client.c
index c63677a..f05a6f8 100644
--- a/console-client.c
+++ b/console-client.c
@@ -90,8 +90,9 @@
 			/* We need to print everything to skip the tilde */
 			rc = write_buf_to_fd(client->console_sd, out_buf,
 					     i - (out_buf - buf));
-			if (rc < 0)
+			if (rc < 0) {
 				return PROCESS_ERR;
+			}
 			out_buf = &buf[i + 1];
 			break;
 		case '\r':
@@ -115,10 +116,11 @@
 	size_t i;
 
 	for (i = 0; i < len; ++i) {
-		if (buf[i] == esc_state->str[esc_state->pos])
+		if (buf[i] == esc_state->str[esc_state->pos]) {
 			esc_state->pos++;
-		else
+		} else {
 			esc_state->pos = 0;
+		}
 
 		if (esc_state->str[esc_state->pos] == '\0') {
 			prc = PROCESS_ESC;
@@ -127,8 +129,9 @@
 		}
 	}
 
-	if (write_buf_to_fd(client->console_sd, buf, i) < 0)
+	if (write_buf_to_fd(client->console_sd, buf, i) < 0) {
 		return PROCESS_ERR;
+	}
 	return prc;
 }
 
@@ -138,10 +141,12 @@
 	ssize_t len;
 
 	len = read(client->fd_in, buf, sizeof(buf));
-	if (len < 0)
+	if (len < 0) {
 		return PROCESS_ERR;
-	if (len == 0)
+	}
+	if (len == 0) {
 		return PROCESS_EXIT;
+	}
 
 	switch (client->esc_type) {
 	case ESC_TYPE_SSH:
@@ -186,8 +191,9 @@
 	client->fd_out = STDOUT_FILENO;
 	client->is_tty = isatty(client->fd_in);
 
-	if (!client->is_tty)
+	if (!client->is_tty) {
 		return 0;
+	}
 
 	rc = tcgetattr(client->fd_in, &termios);
 	if (rc) {
@@ -223,17 +229,19 @@
 	addr.sun_family = AF_UNIX;
 	len = console_socket_path(&addr, socket_id);
 	if (len < 0) {
-		if (errno)
+		if (errno) {
 			warn("Failed to configure socket: %s", strerror(errno));
-		else
+		} else {
 			warn("Socket name length exceeds buffer limits");
+		}
 		goto cleanup;
 	}
 
 	rc = connect(client->console_sd, (struct sockaddr *)&addr,
 		     sizeof(addr) - sizeof(addr.sun_path) + len);
-	if (!rc)
+	if (!rc) {
 		return 0;
+	}
 
 	console_socket_path_readable(&addr, len, path);
 	warn("Can't connect to console server '@%s'", path);
@@ -244,8 +252,9 @@
 
 static void client_fini(struct console_client *client)
 {
-	if (client->is_tty)
+	if (client->is_tty) {
 		tcsetattr(client->fd_in, TCSANOW, &client->orig_termios);
+	}
 	close(client->console_sd);
 }
 
@@ -266,8 +275,9 @@
 
 	for (;;) {
 		rc = getopt(argc, argv, "c:e:i:");
-		if (rc == -1)
+		if (rc == -1) {
 			break;
+		}
 
 		switch (rc) {
 		case 'c':
@@ -310,12 +320,14 @@
 			return EXIT_FAILURE;
 		}
 
-		if (!esc)
+		if (!esc) {
 			esc = (const uint8_t *)config_get_value(
 				config, "escape-sequence");
+		}
 
-		if (!socket_id)
+		if (!socket_id) {
 			socket_id = config_get_value(config, "socket-id");
+		}
 	}
 
 	if (esc) {
@@ -324,12 +336,14 @@
 	}
 
 	rc = client_init(client, socket_id);
-	if (rc)
+	if (rc) {
 		goto out_config_fini;
+	}
 
 	rc = client_tty_init(client);
-	if (rc)
+	if (rc) {
 		goto out_client_fini;
+	}
 
 	for (;;) {
 		pollfds[0].fd = client->fd_in;
@@ -343,25 +357,30 @@
 			break;
 		}
 
-		if (pollfds[0].revents)
+		if (pollfds[0].revents) {
 			prc = process_tty(client);
+		}
 
-		if (prc == PROCESS_OK && pollfds[1].revents)
+		if (prc == PROCESS_OK && pollfds[1].revents) {
 			prc = process_console(client);
+		}
 
 		rc = (prc == PROCESS_ERR) ? -1 : 0;
-		if (prc != PROCESS_OK)
+		if (prc != PROCESS_OK) {
 			break;
+		}
 	}
 
 out_client_fini:
 	client_fini(client);
 
 out_config_fini:
-	if (config_path)
+	if (config_path) {
 		config_fini(config);
+	}
 
-	if (prc == PROCESS_ESC)
+	if (prc == PROCESS_ESC) {
 		return EXIT_ESCAPE;
+	}
 	return rc ? EXIT_FAILURE : EXIT_SUCCESS;
 }
diff --git a/console-server.c b/console-server.c
index 8e24da6..1a1c4be 100644
--- a/console-server.c
+++ b/console-server.c
@@ -116,8 +116,9 @@
 
 	/* udev may rename the tty name with a symbol link, try to resolve */
 	rc = asprintf(&tty_path_input, "/dev/%s", console->tty_kname);
-	if (rc < 0)
+	if (rc < 0) {
 		return -1;
+	}
 
 	tty_path_input_real = realpath(tty_path_input, NULL);
 	if (!tty_path_input_real) {
@@ -135,8 +136,9 @@
 
 	rc = asprintf(&tty_class_device_link, "/sys/class/tty/%s",
 		      tty_kname_real);
-	if (rc < 0)
+	if (rc < 0) {
 		goto out_free;
+	}
 
 	tty_device_tty_dir = realpath(tty_class_device_link, NULL);
 	if (!tty_device_tty_dir) {
@@ -146,16 +148,19 @@
 	}
 
 	rc = asprintf(&tty_device_reldir, "%s/../../", tty_device_tty_dir);
-	if (rc < 0)
+	if (rc < 0) {
 		goto out_free;
+	}
 
 	console->tty_sysfs_devnode = realpath(tty_device_reldir, NULL);
-	if (!console->tty_sysfs_devnode)
+	if (!console->tty_sysfs_devnode) {
 		warn("Can't find parent device for %s", tty_kname_real);
+	}
 
 	rc = asprintf(&console->tty_dev, "/dev/%s", tty_kname_real);
-	if (rc < 0)
+	if (rc < 0) {
 		goto out_free;
+	}
 
 	rc = 0;
 
@@ -176,8 +181,9 @@
 	int rc;
 
 	rc = asprintf(&path, "%s/%s", console->tty_sysfs_devnode, name);
-	if (rc < 0)
+	if (rc < 0) {
 		return -1;
+	}
 
 	fp = fopen(path, "w");
 	if (!fp) {
@@ -189,9 +195,10 @@
 	setvbuf(fp, NULL, _IONBF, 0);
 
 	rc = fprintf(fp, "0x%x", value);
-	if (rc < 0)
+	if (rc < 0) {
 		warn("Error writing to %s attribute of device %s", name,
 		     console->tty_kname);
+	}
 	fclose(fp);
 
 out_free:
@@ -214,8 +221,9 @@
 	}
 
 	if (console->tty_baud) {
-		if (cfsetspeed(&termios, console->tty_baud) < 0)
+		if (cfsetspeed(&termios, console->tty_baud) < 0) {
 			warn("Couldn't set speeds for %s", console->tty_kname);
+		}
 	}
 
 	/* Set console to raw mode: we don't want any processing to occur on
@@ -224,8 +232,9 @@
 	cfmakeraw(&termios);
 
 	rc = tcsetattr(console->tty_fd, TCSANOW, &termios);
-	if (rc)
+	if (rc) {
 		warn("Can't set terminal options for %s", console->tty_kname);
+	}
 }
 
 static void tty_change_baudrate(struct console *console)
@@ -237,13 +246,15 @@
 
 	for (i = 0; i < console->n_handlers; i++) {
 		handler = console->handlers[i];
-		if (!handler->baudrate)
+		if (!handler->baudrate) {
 			continue;
+		}
 
 		rc = handler->baudrate(handler, console->tty_baud);
-		if (rc)
+		if (rc) {
 			warnx("Can't set terminal baudrate for handler %s",
 			      handler->name);
+		}
 	}
 }
 
@@ -252,11 +263,13 @@
  */
 static int tty_init_io(struct console *console)
 {
-	if (console->tty_sirq)
+	if (console->tty_sirq) {
 		tty_set_sysfs_attr(console, "sirq", console->tty_sirq);
-	if (console->tty_lpc_addr)
+	}
+	if (console->tty_lpc_addr) {
 		tty_set_sysfs_attr(console, "lpc_address",
 				   console->tty_lpc_addr);
+	}
 
 	console->tty_fd = open(console->tty_dev, O_RDWR);
 	if (console->tty_fd <= 0) {
@@ -315,18 +328,21 @@
 			     val);
 		}
 
-		if (parsed > 16)
+		if (parsed > 16) {
 			warn("Invalid LPC SERIRQ: '%s'", val);
+		}
 
 		console->tty_sirq = (int)parsed;
-		if (endp == optarg)
+		if (endp == optarg) {
 			warn("Invalid sirq: '%s'", val);
+		}
 	}
 
 	val = config_get_value(config, "baud");
 	if (val) {
-		if (config_parse_baud(&console->tty_baud, val))
+		if (config_parse_baud(&console->tty_baud, val)) {
 			warnx("Invalid baud rate: '%s'", val);
+		}
 	}
 
 	if (!console->tty_kname) {
@@ -335,8 +351,9 @@
 	}
 
 	rc = tty_find_device(console);
-	if (rc)
+	if (rc) {
 		return rc;
+	}
 
 	rc = tty_init_io(console);
 	return rc;
@@ -390,8 +407,9 @@
 	int r;
 
 	baudrate = parse_baud_to_int(console->tty_baud);
-	if (!baudrate)
+	if (!baudrate) {
 		warnx("Invalid baud rate: '%d'", console->tty_baud);
+	}
 
 	r = sd_bus_message_append(reply, "u", baudrate);
 
@@ -467,8 +485,9 @@
 		handler = console->handlers[i];
 
 		rc = 0;
-		if (handler->init)
+		if (handler->init) {
 			rc = handler->init(handler, console, config);
+		}
 
 		handler->active = rc == 0;
 
@@ -484,8 +503,9 @@
 
 	for (i = 0; i < console->n_handlers; i++) {
 		handler = console->handlers[i];
-		if (handler->fini && handler->active)
+		if (handler->fini && handler->active) {
 			handler->fini(handler);
+		}
 	}
 }
 
@@ -500,8 +520,9 @@
 	 * convenient for calculations, so convert to that.
 	 */
 	rc = clock_gettime(CLOCK_MONOTONIC, &t);
-	if (rc)
+	if (rc) {
 		return rc;
+	}
 
 	tv->tv_sec = t.tv_sec;
 	tv->tv_usec = t.tv_nsec / 1000;
@@ -566,9 +587,11 @@
 	int i;
 
 	/* find the entry in our pollers array */
-	for (i = 0; i < console->n_pollers; i++)
-		if (console->pollers[i] == poller)
+	for (i = 0; i < console->n_pollers; i++) {
+		if (console->pollers[i] == poller) {
 			break;
+		}
+	}
 
 	assert(i < console->n_pollers);
 
@@ -607,9 +630,11 @@
 	int i;
 
 	/* find the entry in our pollers array */
-	for (i = 0; i < console->n_pollers; i++)
-		if (console->pollers[i] == poller)
+	for (i = 0; i < console->n_pollers; i++) {
+		if (console->pollers[i] == poller) {
 			break;
+		}
+	}
 
 	console->pollfds[i].events = (short)(events & 0x7fff);
 }
@@ -621,8 +646,9 @@
 	int rc;
 
 	rc = get_current_time(&now);
-	if (rc)
+	if (rc) {
 		return;
+	}
 
 	timeradd(&now, tv, &poller->timeout);
 }
@@ -686,10 +712,11 @@
 		if (pollfd->revents) {
 			prc = poller->event_fn(poller->handler, pollfd->revents,
 					       poller->data);
-			if (prc == POLLER_EXIT)
+			if (prc == POLLER_EXIT) {
 				rc = -1;
-			else if (prc == POLLER_REMOVE)
+			} else if (prc == POLLER_REMOVE) {
 				poller->remove = true;
+			}
 		}
 
 		if ((prc == POLLER_OK) && poller->timeout_fn &&
@@ -724,8 +751,9 @@
 				break;
 			}
 		}
-		if (!removed)
+		if (!removed) {
 			break;
+		}
 	}
 
 	return rc;
@@ -733,8 +761,9 @@
 
 static void sighandler(int signal)
 {
-	if (signal == SIGINT)
+	if (signal == SIGINT) {
 		sigint = true;
+	}
 }
 
 int run_console(struct console *console)
@@ -786,8 +815,9 @@
 				break;
 			}
 			rc = ringbuffer_queue(console->rb, buf, rc);
-			if (rc)
+			if (rc) {
 				break;
+			}
 		}
 
 		if (console->pollfds[console->n_pollers + 1].revents) {
@@ -796,8 +826,9 @@
 
 		/* ... and then the pollers */
 		rc = call_pollers(console, &tv);
-		if (rc)
+		if (rc) {
 			break;
+		}
 	}
 
 	signal(SIGINT, sighandler_save);
@@ -824,8 +855,9 @@
 		int c, idx;
 
 		c = getopt_long(argc, argv, "c:", options, &idx);
-		if (c == -1)
+		if (c == -1) {
 			break;
+		}
 
 		switch (c) {
 		case 'c':
@@ -838,8 +870,9 @@
 		}
 	}
 
-	if (optind < argc)
+	if (optind < argc) {
 		config_tty_kname = argv[optind];
+	}
 
 	console = malloc(sizeof(struct console));
 	memset(console, 0, sizeof(*console));
@@ -853,8 +886,9 @@
 		goto out_free;
 	}
 
-	if (!config_tty_kname)
+	if (!config_tty_kname) {
 		config_tty_kname = config_get_value(config, "upstream-tty");
+	}
 
 	if (!config_tty_kname) {
 		warnx("No TTY device specified");
@@ -865,8 +899,9 @@
 	console->tty_kname = config_tty_kname;
 
 	rc = tty_init(console, config);
-	if (rc)
+	if (rc) {
 		goto out_config_fini;
+	}
 
 	dbus_init(console, config);
 
diff --git a/console-socket.c b/console-socket.c
index 7785688..792ca62 100644
--- a/console-socket.c
+++ b/console-socket.c
@@ -42,8 +42,9 @@
 			      CONSOLE_SOCKET_PREFIX);
 	}
 
-	if (rc < 0)
+	if (rc < 0) {
 		return rc;
+	}
 
 	if ((size_t)rc > (sizeof(addr->sun_path) - 1)) {
 		errno = 0;
@@ -61,8 +62,9 @@
 	const char *src = (const char *)addr;
 	size_t len;
 
-	if (addrlen > SSIZE_MAX)
+	if (addrlen > SSIZE_MAX) {
 		return -EINVAL;
+	}
 
 	len = addrlen - sizeof(addr->sun_family) - 1;
 	memcpy(path, src + sizeof(addr->sun_family) + 1, len);
diff --git a/log-handler.c b/log-handler.c
index 1212b52..5b17c94 100644
--- a/log-handler.c
+++ b/log-handler.c
@@ -84,13 +84,15 @@
 
 	if (lh->size + len > lh->maxsize) {
 		rc = log_trim(lh);
-		if (rc)
+		if (rc) {
 			return rc;
+		}
 	}
 
 	rc = write_buf_to_fd(lh->fd, buf, len);
-	if (rc)
+	if (rc) {
 		return rc;
+	}
 
 	lh->size += len;
 
@@ -109,12 +111,14 @@
 	 * commit straight away. */
 	for (;;) {
 		len = ringbuffer_dequeue_peek(lh->rbc, 0, &buf);
-		if (!len)
+		if (!len) {
 			break;
+		}
 
 		rc = log_data(lh, buf, len);
-		if (rc)
+		if (rc) {
 			return RINGBUFFER_POLL_REMOVE;
+		}
 
 		ringbuffer_dequeue_commit(lh->rbc, len);
 	}
@@ -146,8 +150,9 @@
 	lh->maxsize = logsize <= lh->pagesize ? lh->pagesize + 1 : logsize;
 
 	filename = config_get_value(config, "logfile");
-	if (!filename)
+	if (!filename) {
 		filename = default_filename;
+	}
 
 	lh->fd = open(filename, O_RDWR | O_CREAT | O_TRUNC, 0644);
 	if (lh->fd < 0) {
diff --git a/ringbuffer.c b/ringbuffer.c
index efa5204..856e077 100644
--- a/ringbuffer.c
+++ b/ringbuffer.c
@@ -46,8 +46,9 @@
 	struct ringbuffer *rb;
 
 	rb = malloc(sizeof(*rb) + size);
-	if (!rb)
+	if (!rb) {
 		return NULL;
+	}
 
 	memset(rb, 0, sizeof(*rb));
 	rb->size = size;
@@ -58,8 +59,9 @@
 
 void ringbuffer_fini(struct ringbuffer *rb)
 {
-	while (rb->n_consumers)
+	while (rb->n_consumers) {
 		ringbuffer_consumer_unregister(rb->consumers[0]);
+	}
 	free(rb);
 }
 
@@ -95,9 +97,11 @@
 	struct ringbuffer *rb = rbc->rb;
 	int i;
 
-	for (i = 0; i < rb->n_consumers; i++)
-		if (rb->consumers[i] == rbc)
+	for (i = 0; i < rb->n_consumers; i++) {
+		if (rb->consumers[i] == rbc) {
 			break;
+		}
+	}
 
 	assert(i < rb->n_consumers);
 
@@ -120,10 +124,11 @@
 
 size_t ringbuffer_len(struct ringbuffer_consumer *rbc)
 {
-	if (rbc->pos <= rbc->rb->tail)
+	if (rbc->pos <= rbc->rb->tail) {
 		return rbc->rb->tail - rbc->pos;
-	else
+	} else {
 		return rbc->rb->tail + rbc->rb->size - rbc->pos;
+	}
 }
 
 static size_t ringbuffer_space(struct ringbuffer_consumer *rbc)
@@ -137,14 +142,16 @@
 	enum ringbuffer_poll_ret prc;
 	size_t force_len;
 
-	if (ringbuffer_space(rbc) >= len)
+	if (ringbuffer_space(rbc) >= len) {
 		return 0;
+	}
 
 	force_len = len - ringbuffer_space(rbc);
 
 	prc = rbc->poll_fn(rbc->poll_data, force_len);
-	if (prc != RINGBUFFER_POLL_OK)
+	if (prc != RINGBUFFER_POLL_OK) {
 		return -1;
+	}
 
 	return 0;
 }
@@ -155,11 +162,13 @@
 	size_t wlen;
 	int i, rc;
 
-	if (len >= rb->size)
+	if (len >= rb->size) {
 		return -1;
+	}
 
-	if (len == 0)
+	if (len == 0) {
 		return 0;
+	}
 
 	/* Ensure there is at least len bytes of space available.
 	 *
@@ -212,14 +221,16 @@
 	size_t pos;
 	size_t len;
 
-	if (offset >= ringbuffer_len(rbc))
+	if (offset >= ringbuffer_len(rbc)) {
 		return 0;
+	}
 
 	pos = (rbc->pos + offset) % rb->size;
-	if (pos <= rb->tail)
+	if (pos <= rb->tail) {
 		len = rb->tail - pos;
-	else
+	} else {
 		len = rb->size - pos;
+	}
 
 	*data = rb->buf + pos;
 	return len;
diff --git a/socket-handler.c b/socket-handler.c
index 954c326..d05fec3 100644
--- a/socket-handler.c
+++ b/socket-handler.c
@@ -70,15 +70,19 @@
 	int idx;
 
 	close(client->fd);
-	if (client->poller)
+	if (client->poller) {
 		console_poller_unregister(sh->console, client->poller);
+	}
 
-	if (client->rbc)
+	if (client->rbc) {
 		ringbuffer_consumer_unregister(client->rbc);
+	}
 
-	for (idx = 0; idx < sh->n_clients; idx++)
-		if (sh->clients[idx] == client)
+	for (idx = 0; idx < sh->n_clients; idx++) {
+		if (sh->clients[idx] == client) {
 			break;
+		}
+	}
 
 	assert(idx < sh->n_clients);
 
@@ -102,14 +106,16 @@
 {
 	int events;
 
-	if (client->blocked == blocked)
+	if (client->blocked == blocked) {
 		return;
+	}
 
 	client->blocked = blocked;
 
 	events = POLLIN;
-	if (client->blocked)
+	if (client->blocked) {
 		events |= POLLOUT;
+	}
 
 	console_poller_set_events(client->sh->console, client->poller, events);
 }
@@ -121,14 +127,16 @@
 	ssize_t rc;
 	size_t pos;
 
-	if (len > SSIZE_MAX)
+	if (len > SSIZE_MAX) {
 		return -EINVAL;
+	}
 
 	fd = client->fd;
 
 	flags = MSG_NOSIGNAL;
-	if (!block)
+	if (!block) {
 		flags |= MSG_DONTWAIT;
+	}
 
 	for (pos = 0; pos < len; pos += rc) {
 		rc = send(fd, (char *)buf + pos, len - pos, flags);
@@ -139,13 +147,15 @@
 				break;
 			}
 
-			if (errno == EINTR)
+			if (errno == EINTR) {
 				continue;
+			}
 
 			return -1;
 		}
-		if (rc == 0)
+		if (rc == 0) {
 			return -1;
+		}
 	}
 
 	return (ssize_t)pos;
@@ -166,29 +176,35 @@
 	block = !!force_len;
 
 	/* if we're already blocked, no need for the write */
-	if (!block && client->blocked)
+	if (!block && client->blocked) {
 		return 0;
+	}
 
 	for (;;) {
 		len = ringbuffer_dequeue_peek(client->rbc, total_len, &buf);
-		if (!len)
+		if (!len) {
 			break;
+		}
 
 		wlen = send_all(client, buf, len, block);
-		if (wlen <= 0)
+		if (wlen <= 0) {
 			break;
+		}
 
 		total_len += wlen;
 
-		if (force_len && total_len >= force_len)
+		if (force_len && total_len >= force_len) {
 			break;
+		}
 	}
 
-	if (wlen < 0)
+	if (wlen < 0) {
 		return -1;
+	}
 
-	if (force_len && total_len < force_len)
+	if (force_len && total_len < force_len) {
 		return -1;
+	}
 
 	ringbuffer_dequeue_commit(client->rbc, total_len);
 	return 0;
@@ -253,13 +269,15 @@
 	if (events & POLLIN) {
 		rc = recv(client->fd, buf, sizeof(buf), MSG_DONTWAIT);
 		if (rc < 0) {
-			if (errno == EAGAIN || errno == EWOULDBLOCK)
+			if (errno == EAGAIN || errno == EWOULDBLOCK) {
 				return POLLER_OK;
-			else
+			} else {
 				goto err_close;
+			}
 		}
-		if (rc == 0)
+		if (rc == 0) {
 			goto err_close;
+		}
 
 		console_data_out(sh->console, buf, rc);
 	}
@@ -267,8 +285,9 @@
 	if (events & POLLOUT) {
 		client_set_blocked(client, false);
 		rc = client_drain_queue(client, 0);
-		if (rc)
+		if (rc) {
 			goto err_close;
+		}
 	}
 
 	return POLLER_OK;
@@ -286,12 +305,14 @@
 	struct client *client;
 	int fd, n;
 
-	if (!(events & POLLIN))
+	if (!(events & POLLIN)) {
 		return POLLER_OK;
+	}
 
 	fd = accept(sh->sd, NULL, NULL);
-	if (fd < 0)
+	if (fd < 0) {
 		return POLLER_OK;
+	}
 
 	client = malloc(sizeof(*client));
 	memset(client, 0, sizeof(*client));
@@ -335,10 +356,11 @@
 	addr.sun_family = AF_UNIX;
 	len = console_socket_path(&addr, config_get_value(config, "socket-id"));
 	if (len < 0) {
-		if (errno)
+		if (errno) {
 			warn("Failed to configure socket: %s", strerror(errno));
-		else
+		} else {
 			warn("Socket name length exceeds buffer limits");
+		}
 		return -1;
 	}
 
@@ -385,11 +407,13 @@
 {
 	struct socket_handler *sh = to_socket_handler(handler);
 
-	while (sh->n_clients)
+	while (sh->n_clients) {
 		client_close(sh->clients[0]);
+	}
 
-	if (sh->poller)
+	if (sh->poller) {
 		console_poller_unregister(sh->console, sh->poller);
+	}
 
 	close(sh->sd);
 }
diff --git a/test/ringbuffer-test-utils.c b/test/ringbuffer-test-utils.c
index 56e37ee..fff4325 100644
--- a/test/ringbuffer-test-utils.c
+++ b/test/ringbuffer-test-utils.c
@@ -36,30 +36,35 @@
 	size_t len, total_len;
 	uint8_t *buf;
 
-	if (ctx->ignore_poll)
+	if (ctx->ignore_poll) {
 		return RINGBUFFER_POLL_OK;
+	}
 
-	if (ctx->force_only && !force_len)
+	if (ctx->force_only && !force_len) {
 		return RINGBUFFER_POLL_OK;
+	}
 
 	ctx->count++;
 
 	total_len = 0;
 	for (;;) {
 		len = ringbuffer_dequeue_peek(ctx->rbc, total_len, &buf);
-		if (!len)
+		if (!len) {
 			break;
+		}
 
-		if (ctx->force_only && total_len + len > force_len)
+		if (ctx->force_only && total_len + len > force_len) {
 			len = force_len - total_len;
+		}
 
 		ctx->data = realloc(ctx->data, ctx->len + len);
 		memcpy(ctx->data + ctx->len, buf, len);
 		ctx->len += len;
 		total_len += len;
 
-		if (ctx->force_only && total_len >= force_len)
+		if (ctx->force_only && total_len >= force_len) {
 			break;
+		}
 	}
 	ringbuffer_dequeue_commit(ctx->rbc, total_len);
 
@@ -79,16 +84,19 @@
 		bool has_consumer = false;
 		const char *prefix = "";
 
-		if (rb->tail == i)
+		if (rb->tail == i) {
 			prefix = "tail=>";
+		}
 
 		printf("%6s %02x", prefix, rb->buf[i]);
 		for (j = 0; j < rb->n_consumers; j++) {
 			rbc = rb->consumers[j];
-			if (rbc->pos != i)
+			if (rbc->pos != i) {
 				continue;
-			if (!has_consumer)
+			}
+			if (!has_consumer) {
 				printf(" <=");
+			}
 			printf("c[%d],len=%zd ", j, ringbuffer_len(rbc));
 			has_consumer = true;
 		}
diff --git a/test/test-client-escape.c b/test/test-client-escape.c
index b818889..b3083b7 100644
--- a/test/test-client-escape.c
+++ b/test/test-client-escape.c
@@ -180,8 +180,9 @@
 		return -1;
 	}
 
-	if (ctx->cur_in >= ctx->test->n_in)
+	if (ctx->cur_in >= ctx->test->n_in) {
 		return 0;
+	}
 
 	inbuf = ctx->test->in[ctx->cur_in];
 	inlen = strlen(inbuf);
@@ -209,8 +210,9 @@
 
 	for (;;) {
 		rc = process_tty(&ctx->client);
-		if (rc != PROCESS_OK)
+		if (rc != PROCESS_OK) {
 			break;
+		}
 	}
 
 	exp_out_len = strlen(test->exp_out);
@@ -229,8 +231,9 @@
 {
 	size_t i;
 
-	for (i = 0; i < ARRAY_SIZE(tests); i++)
+	for (i = 0; i < ARRAY_SIZE(tests); i++) {
 		run_one_test(i, &tests[i], &ctxs[i]);
+	}
 
 	return EXIT_SUCCESS;
 }
diff --git a/test/test-config-parse-logsize.c b/test/test-config-parse-logsize.c
index 9bd4f79..4946cf0 100644
--- a/test/test-config-parse-logsize.c
+++ b/test/test-config-parse-logsize.c
@@ -58,8 +58,9 @@
 			     test_data[i].expected_size, size);
 		}
 		assert(rc == test_data[i].expected_rc);
-		if (rc == 0)
+		if (rc == 0) {
 			assert(size == test_data[i].expected_size);
+		}
 	}
 }
 
diff --git a/test/test-config-parse.c b/test/test-config-parse.c
index 7d2d687..df90e91 100644
--- a/test/test-config-parse.c
+++ b/test/test-config-parse.c
@@ -23,8 +23,9 @@
 	config_parse(ctx, buf);
 	free(buf);
 	found = config_get_value(ctx, key);
-	if (!expected)
+	if (!expected) {
 		assert(!found);
+	}
 	if (expected) {
 		assert(found);
 		assert(!strcmp(expected, found));
diff --git a/test/test-ringbuffer-boundary-read.c b/test/test-ringbuffer-boundary-read.c
index 642c345..f62f66f 100644
--- a/test/test-ringbuffer-boundary-read.c
+++ b/test/test-ringbuffer-boundary-read.c
@@ -34,8 +34,9 @@
 	pos = 0;
 	for (;;) {
 		len = ringbuffer_dequeue_peek(rbc, pos, &out_buf);
-		if (len == 0)
+		if (len == 0) {
 			break;
+		}
 		assert(!memcmp(in_buf + pos, out_buf, len));
 		pos += len;
 	}
diff --git a/test/test-ringbuffer-contained-offset-read.c b/test/test-ringbuffer-contained-offset-read.c
index 7490f01..1fbe1cb 100644
--- a/test/test-ringbuffer-contained-offset-read.c
+++ b/test/test-ringbuffer-contained-offset-read.c
@@ -25,8 +25,9 @@
 	for (i = 0; i <= sizeof(in_buf); i++) {
 		len = ringbuffer_dequeue_peek(rbc, i, &out_buf);
 		assert(len == sizeof(in_buf) - i);
-		if (len)
+		if (len) {
 			assert(!memcmp(in_buf + i, out_buf, len));
+		}
 	}
 
 	ringbuffer_fini(rb);
diff --git a/tty-handler.c b/tty-handler.c
index dd348b6..a02d899 100644
--- a/tty-handler.c
+++ b/tty-handler.c
@@ -46,8 +46,9 @@
 	int flags;
 
 	flags = th->fd_flags & ~O_NONBLOCK;
-	if (!fd_blocking)
+	if (!fd_blocking) {
 		flags |= O_NONBLOCK;
+	}
 
 	if (flags != th->fd_flags) {
 		fcntl(th->fd, F_SETFL, flags);
@@ -68,14 +69,16 @@
 {
 	int events;
 
-	if (blocked == th->blocked)
+	if (blocked == th->blocked) {
 		return;
+	}
 
 	th->blocked = blocked;
 	events = POLLIN;
 
-	if (th->blocked)
+	if (th->blocked) {
 		events |= POLLOUT;
+	}
 
 	console_poller_set_events(th->console, th->poller, events);
 }
@@ -87,28 +90,32 @@
 	uint8_t *buf;
 
 	/* if we're forcing data, we need to clear non-blocking mode */
-	if (force_len)
+	if (force_len) {
 		tty_set_fd_blocking(th, true);
 
-	/* no point writing, we'll just see -EAGAIN */
-	else if (th->blocked)
+		/* no point writing, we'll just see -EAGAIN */
+	} else if (th->blocked) {
 		return 0;
+	}
 
 	total_len = 0;
 
 	for (;;) {
 		len = ringbuffer_dequeue_peek(th->rbc, total_len, &buf);
-		if (!len)
+		if (!len) {
 			break;
+		}
 
 		/* write as little as possible while blocking */
-		if (force_len && force_len < total_len + len)
+		if (force_len && force_len < total_len + len) {
 			len = force_len - total_len;
+		}
 
 		wlen = write(th->fd, buf, len);
 		if (wlen < 0) {
-			if (errno == EINTR)
+			if (errno == EINTR) {
 				continue;
+			}
 			if ((errno == EAGAIN || errno == EWOULDBLOCK) &&
 			    !force_len) {
 				tty_set_blocked(th, true);
@@ -120,14 +127,16 @@
 
 		total_len += wlen;
 
-		if (force_len && total_len >= force_len)
+		if (force_len && total_len >= force_len) {
 			break;
+		}
 	}
 
 	ringbuffer_dequeue_commit(th->rbc, total_len);
 
-	if (force_len)
+	if (force_len) {
 		tty_set_fd_blocking(th, false);
+	}
 
 	return 0;
 }
@@ -156,8 +165,9 @@
 
 	if (events & POLLIN) {
 		len = read(th->fd, buf, sizeof(buf));
-		if (len <= 0)
+		if (len <= 0) {
 			goto err;
+		}
 
 		console_data_out(th->console, buf, len);
 	}
@@ -165,8 +175,9 @@
 	if (events & POLLOUT) {
 		tty_set_blocked(th, false);
 		rc = tty_drain_queue(th, 0);
-		if (rc)
+		if (rc) {
 			goto err;
+		}
 	}
 
 	return POLLER_OK;
@@ -235,12 +246,14 @@
 	int rc;
 
 	tty_name = config_get_value(config, "local-tty");
-	if (!tty_name)
+	if (!tty_name) {
 		return -1;
+	}
 
 	rc = asprintf(&tty_path, "/dev/%s", tty_name);
-	if (!rc)
+	if (!rc) {
 		return -1;
+	}
 
 	th->fd = open(tty_path, O_RDWR | O_NONBLOCK);
 	if (th->fd < 0) {
@@ -260,15 +273,17 @@
 				tty_baud);
 		} else {
 			rc = set_terminal_baud(th, tty_name, desired_speed);
-			if (rc)
+			if (rc) {
 				fprintf(stderr,
 					"Couldn't set baud rate for %s to %s\n",
 					tty_name, tty_baud);
+			}
 		}
 	}
 
-	if (make_terminal_raw(th, tty_name) != 0)
+	if (make_terminal_raw(th, tty_name) != 0) {
 		fprintf(stderr, "Couldn't make %s a raw terminal\n", tty_name);
+	}
 
 	th->poller = console_poller_register(console, handler, tty_poll, NULL,
 					     th->fd, POLLIN, NULL);
@@ -282,8 +297,9 @@
 static void tty_fini(struct handler *handler)
 {
 	struct tty_handler *th = to_tty_handler(handler);
-	if (th->poller)
+	if (th->poller) {
 		console_poller_unregister(th->console, th->poller);
+	}
 	close(th->fd);
 }
 
