minor fix

This commit is contained in:
Maxim Devaev
2024-02-29 03:29:23 +02:00
parent ca3638313b
commit 7bacef7622
9 changed files with 15 additions and 15 deletions

View File

@@ -234,7 +234,7 @@ void us_device_close(us_device_s *dev) {
for (uint index = 0; index < run->n_bufs; ++index) {
us_hw_buffer_s *hw = &run->hw_bufs[index];
US_CLOSE_FD(hw->dma_fd, close);
US_CLOSE_FD(hw->dma_fd);
if (dev->io_method == V4L2_MEMORY_MMAP) {
if (hw->raw.allocated > 0 && hw->raw.data != NULL) {
@@ -254,7 +254,7 @@ void us_device_close(us_device_s *dev) {
run->n_bufs = 0;
}
US_CLOSE_FD(run->fd, close);
US_CLOSE_FD(run->fd);
run->persistent_timeout_reported = false;
}
@@ -920,7 +920,7 @@ static int _device_open_export_to_dma(us_device_s *dev) {
error:
for (uint index = 0; index < run->n_bufs; ++index) {
US_CLOSE_FD(run->hw_bufs[index].dma_fd, close);
US_CLOSE_FD(run->hw_bufs[index].dma_fd);
}
return -1;
}

View File

@@ -179,7 +179,7 @@ int us_memsink_server_put(us_memsink_s *sink, const us_frame_s *frame, bool *key
return 0;
}
int us_memsink_client_get(us_memsink_s *sink, us_frame_s *frame, bool *key_requested, bool key_required) { // cppcheck-suppress unusedFunction
int us_memsink_client_get(us_memsink_s *sink, us_frame_s *frame, bool *key_requested, bool key_required) {
assert(!sink->server); // Client only
if (us_flock_timedwait_monotonic(sink->fd, sink->timeout) < 0) {

View File

@@ -59,7 +59,7 @@
#define US_CALLOC(x_dest, x_nmemb) assert(((x_dest) = calloc((x_nmemb), sizeof(*(x_dest)))) != NULL)
#define US_REALLOC(x_dest, x_nmemb) assert(((x_dest) = realloc((x_dest), (x_nmemb) * sizeof(*(x_dest)))) != NULL)
#define US_DELETE(x_dest, x_free) { if (x_dest) { x_free(x_dest); x_dest = NULL; } }
#define US_CLOSE_FD(x_dest, x_close) { if (x_dest >= 0) { x_close(x_dest); x_dest = -1; } }
#define US_CLOSE_FD(x_dest) { if (x_dest >= 0) { close(x_dest); x_dest = -1; } }
#define US_MEMSET_ZERO(x_obj) memset(&(x_obj), 0, sizeof(x_obj))
#define US_SNPRINTF(x_dest, x_size, x_fmt, ...) assert(snprintf((x_dest), (x_size), (x_fmt), ##__VA_ARGS__) > 0)