diff --git a/src/libcamera/buffer.cpp b/src/libcamera/buffer.cpp
index 6dfebfc6bb28..c86847daf193 100644
--- a/src/libcamera/buffer.cpp
+++ b/src/libcamera/buffer.cpp
@@ -43,6 +43,8 @@ Buffer::~Buffer()
  * \brief Set the dmabuf file handle backing the buffer
  *
  * The \a fd dmabuf file handle is duplicated and stored.
+ *
+ * \return 0 on success or a negative error value otherwise.
  */
 int Buffer::setDmabuf(int fd)
 {
@@ -51,12 +53,19 @@ int Buffer::setDmabuf(int fd)
 		fd_ = -1;
 	}
 
-	if (fd != -1)
-		return 0;
+	if (fd < 0) {
+		LOG(Buffer, Error) << "Invalid DMABuf FD provided";
+		return -EINVAL;
+	}
 
 	fd_ = dup(fd);
-	if (fd_ == -1)
-		return -errno;
+	if (fd_ == -1) {
+		int ret = -errno;
+		LOG(Buffer, Error)
+			<< "Failed to duplicate Dmabuf: " << strerror(-ret);
+
+		return ret;
+	}
 
 	return 0;
 }
