From 2029af39cc9d396f69c52550595d1aeedce5e2d2 Mon Sep 17 00:00:00 2001 From: Moritz Fischer Date: Tue, 10 Oct 2017 12:02:00 -0700 Subject: transport: liberio: Check return values for liberio_chan_set_fixed_size() Check return value of liberio_chan_set_fixed_size() since it can fail, and bad things happen if one just proceeds. Signed-off-by: Moritz Fischer --- host/lib/transport/liberio_zero_copy.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/host/lib/transport/liberio_zero_copy.cpp b/host/lib/transport/liberio_zero_copy.cpp index fb30f8936..40cedd3ed 100644 --- a/host/lib/transport/liberio_zero_copy.cpp +++ b/host/lib/transport/liberio_zero_copy.cpp @@ -143,8 +143,11 @@ public: UHD_ASSERT_THROW(_tx_chan); liberio_chan_stop_streaming(_tx_chan); liberio_chan_request_buffers(_tx_chan, 0); - liberio_chan_set_fixed_size(_tx_chan, 0, - xport_params.send_frame_size); + UHD_ASSERT_THROW( + !liberio_chan_set_fixed_size(_tx_chan, 0, + xport_params.send_frame_size + ) + ); UHD_ASSERT_THROW( !liberio_chan_request_buffers( _tx_chan, xport_params.num_send_frames @@ -171,8 +174,11 @@ public: /* stop the channel, free the buffers, set the size, allocate */ liberio_chan_stop_streaming(_rx_chan); liberio_chan_request_buffers(_rx_chan, 0); - liberio_chan_set_fixed_size(_rx_chan, 0, - xport_params.recv_frame_size); + UHD_ASSERT_THROW( + !liberio_chan_set_fixed_size(_rx_chan, 0, + xport_params.recv_frame_size + ) + ); UHD_ASSERT_THROW(!liberio_chan_request_buffers( _rx_chan, xport_params.num_recv_frames)); _num_recv_bufs = liberio_chan_get_num_bufs(_rx_chan); -- cgit v1.2.3