pespin has uploaded this change for review.

View Change

osmo_io: Simplify early return path

Change-Id: I985077cc0e2c11c4b6937f7e0f9bca61518716e0
---
M src/core/osmo_io.c
1 file changed, 2 insertions(+), 3 deletions(-)

git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/65/39065/1
diff --git a/src/core/osmo_io.c b/src/core/osmo_io.c
index 9c93e25..bff86d2 100644
--- a/src/core/osmo_io.c
+++ b/src/core/osmo_io.c
@@ -736,13 +736,12 @@
{
int rc = 0;

- if (fd >= 0)
- iofd->fd = fd;
- else if (iofd->fd < 0) {
+ if (iofd->fd < 0) {
/* this might happen if both osmo_iofd_setup() and osmo_iofd_register() are called with -1 */
LOGPIO(iofd, LOGL_ERROR, "Cannot register io_fd using invalid fd == %d\n", iofd->fd);
return -EBADF;
}
+ iofd->fd = fd;

rc = osmo_iofd_ops.register_fd(iofd);
if (rc)

To view, visit change 39065. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: newchange
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I985077cc0e2c11c4b6937f7e0f9bca61518716e0
Gerrit-Change-Number: 39065
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin@sysmocom.de>