obmc-console: Fix readability-else-after-return
```
/usr/bin/clang-tidy -checks=-*, readability-else-after-return -export-fixes /tmp/tmpzmyw6on0/tmpdk8wt96i.yaml -p=build /mnt/host/andrew/home/andrew/src/openbmc/obmc-console/test/test-ringbuffer-boundary-poll.c
/mnt/host/andrew/home/andrew/src/openbmc/obmc-console/build/../ringbuffer.c:131:4: error: do not use 'else' after 'return' [readability-else-after-return,-warnings-as-errors]
} else {
^~~~~~
```
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Change-Id: Ic80538a64f061f9ed3d3d71293dcf4f3d99cb6e4
diff --git a/console-server.c b/console-server.c
index 1a1c4be..2750349 100644
--- a/console-server.c
+++ b/console-server.c
@@ -680,14 +680,11 @@
timersub(earliest, cur_time, &interval);
return ((interval.tv_sec * 1000) +
(interval.tv_usec / 1000));
- } else {
- /* return from poll immediately */
- return 0;
- }
- } else {
- /* poll indefinitely */
- return -1;
- }
+ } /* return from poll immediately */
+ return 0;
+
+ } /* poll indefinitely */
+ return -1;
}
static int call_pollers(struct console *console, struct timeval *cur_time)
@@ -800,10 +797,9 @@
if (rc < 0) {
if (errno == EINTR) {
continue;
- } else {
- warn("poll error");
- break;
}
+ warn("poll error");
+ break;
}
/* process internal fd first */
diff --git a/ringbuffer.c b/ringbuffer.c
index 856e077..93e78c3 100644
--- a/ringbuffer.c
+++ b/ringbuffer.c
@@ -126,9 +126,8 @@
{
if (rbc->pos <= rbc->rb->tail) {
return rbc->rb->tail - rbc->pos;
- } else {
- return rbc->rb->tail + rbc->rb->size - rbc->pos;
}
+ return rbc->rb->tail + rbc->rb->size - rbc->pos;
}
static size_t ringbuffer_space(struct ringbuffer_consumer *rbc)
diff --git a/socket-handler.c b/socket-handler.c
index d05fec3..f37dcb8 100644
--- a/socket-handler.c
+++ b/socket-handler.c
@@ -271,9 +271,8 @@
if (rc < 0) {
if (errno == EAGAIN || errno == EWOULDBLOCK) {
return POLLER_OK;
- } else {
- goto err_close;
}
+ goto err_close;
}
if (rc == 0) {
goto err_close;