Change in libosmocore[master]: osmo_libusb: check return value of osmo_fd_register()

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

laforge gerrit-no-reply at lists.osmocom.org
Mon Feb 10 09:58:59 UTC 2020


laforge has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/17109 )

Change subject: osmo_libusb: check return value of osmo_fd_register()
......................................................................

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
---
M src/usb/osmo_libusb.c
1 file changed, 4 insertions(+), 1 deletion(-)

Approvals:
  Jenkins Builder: Verified
  pespin: Looks good to me, but someone else must approve
  laforge: Looks good to me, approved



diff --git a/src/usb/osmo_libusb.c b/src/usb/osmo_libusb.c
index 7a13a7e..3c8a22a 100644
--- a/src/usb/osmo_libusb.c
+++ b/src/usb/osmo_libusb.c
@@ -86,6 +86,7 @@
 	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 @@
 		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 */

-- 
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/17109
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Ia20755ec12ee9fb0eba8322551642a96e68e1570
Gerrit-Change-Number: 17109
Gerrit-PatchSet: 2
Gerrit-Owner: fixeria <axilirator at gmail.com>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200210/0fdaa558/attachment.htm>


More information about the gerrit-log mailing list