aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVadim Yanitskiy <axilirator@gmail.com>2020-02-09 04:19:04 +0700
committerVadim Yanitskiy <axilirator@gmail.com>2020-02-09 04:27:50 +0700
commit775a6b0ddd0f650febf51a50507c76e021fa543f (patch)
treeef9fc05b55f9d0bda46f497b9a6deeb163d89c30 /src
parenta8809f0a161e1f074bf2fe4f427081b5947376bb (diff)
osmo_libusb: check return value of osmo_fd_register()
Most likely, we should not assert() here, but let's at least log an error message in case if osmo_fd_register() fails. Change-Id: Ia20755ec12ee9fb0eba8322551642a96e68e1570 Related: CID#206572
Diffstat (limited to 'src')
-rw-r--r--src/usb/osmo_libusb.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/usb/osmo_libusb.c b/src/usb/osmo_libusb.c
index 7a13a7e3..3c8a22a8 100644
--- a/src/usb/osmo_libusb.c
+++ b/src/usb/osmo_libusb.c
@@ -86,6 +86,7 @@ static void osmo_usb_added_cb(int fd, short events, void *user_data)
struct osmo_fd *ofd = talloc_zero(OTC_GLOBAL, struct osmo_fd);
libusb_context *luctx = user_data;
unsigned int when = 0;
+ int rc;
if (events & POLLIN)
when |= OSMO_FD_READ;
@@ -93,7 +94,9 @@ static void osmo_usb_added_cb(int fd, short events, void *user_data)
when |= OSMO_FD_WRITE;
osmo_fd_setup(ofd, fd, when, osmo_usb_fd_cb, luctx, 0);
- osmo_fd_register(ofd);
+ rc = osmo_fd_register(ofd);
+ if (rc)
+ LOGP(DLUSB, LOGL_ERROR, "osmo_fd_register() failed with rc=%d\n", rc);
}
/* called by libusb if it wants to remove a file-descriptor */