From 90ddeb9ef88675bfd5cc84be3c2ee215f9404720 Mon Sep 17 00:00:00 2001 From: Giovanni Di Sirio Date: Sat, 5 Jan 2019 15:27:33 +0000 Subject: Assertion added to serial_usb driver in order to detect an anomalous condition. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@12528 110e8d01-0319-4d1e-a829-52ad28d1bb01 --- os/hal/src/hal_serial_usb.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'os/hal') diff --git a/os/hal/src/hal_serial_usb.c b/os/hal/src/hal_serial_usb.c index 4932ccb3d..97aa2ecd0 100644 --- a/os/hal/src/hal_serial_usb.c +++ b/os/hal/src/hal_serial_usb.c @@ -188,12 +188,11 @@ static void obnotify(io_buffers_queue_t *bqp) { /* Checking if there is already a transaction ongoing on the endpoint.*/ if (!usbGetTransmitStatusI(sdup->config->usbp, sdup->config->bulk_in)) { - /* Trying to get a full buffer.*/ + /* Getting a full buffer, a buffer is available for sure because this + callback is invoked when one has been inserted.*/ uint8_t *buf = obqGetFullBufferI(&sdup->obqueue, &n); - if (buf != NULL) { - /* Buffer found, starting a new transaction.*/ - usbStartTransmitI(sdup->config->usbp, sdup->config->bulk_in, buf, n); - } + osalDbgAssert(buf != NULL, "buffer not found"); + usbStartTransmitI(sdup->config->usbp, sdup->config->bulk_in, buf, n); } } -- cgit v1.2.3