[libcamera-devel,RFC,1/2] libcamera: IPCPipeUnixSocket: Check that insertion succeeds
diff mbox series

Message ID 20210208234733.2637061-2-niklas.soderlund@ragnatech.se
State Superseded
Delegated to: Paul Elder
Headers show
Series
  • ipu3: Translate IPA protocol to new mojo interface
Related show

Commit Message

Niklas Söderlund Feb. 8, 2021, 11:47 p.m. UTC
Make sure the insertion succeeds. This was found by compile tests
with gcc7 which points out 'success' is not used.

  ../../src/libcamera/ipc_pipe_unixsocket.cpp:119:27: error: unused variable ‘success’ [-Werror=unused-variable]
    const auto [iter, success] = callData_.insert({ cookie, { response, false } });

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
---
 src/libcamera/ipc_pipe_unixsocket.cpp | 5 +++++
 1 file changed, 5 insertions(+)

Patch
diff mbox series

diff --git a/src/libcamera/ipc_pipe_unixsocket.cpp b/src/libcamera/ipc_pipe_unixsocket.cpp
index 2bdce29e24d9acd1..cdb7eae0653384eb 100644
--- a/src/libcamera/ipc_pipe_unixsocket.cpp
+++ b/src/libcamera/ipc_pipe_unixsocket.cpp
@@ -118,6 +118,11 @@  int IPCPipeUnixSocket::call(const IPCUnixSocket::Payload &message,
 
 	const auto [iter, success] = callData_.insert({ cookie, { response, false } });
 
+	if (!success) {
+		LOG(IPCPipe, Error) << "Failed to insert call data";
+		return -EINVAL;
+	}
+
 	ret = socket_->send(message);
 	if (ret) {
 		callData_.erase(iter);