diff --git a/include/libcamera/internal/media_device.h b/include/libcamera/internal/media_device.h
index eb8cfde4..b09dfd16 100644
--- a/include/libcamera/internal/media_device.h
+++ b/include/libcamera/internal/media_device.h
@@ -33,7 +33,7 @@ public:
 	bool busy() const { return acquired_; }
 
 	bool lock();
-	void unlock();
+	bool unlock();
 
 	int populate();
 	bool isValid() const { return valid_; }
diff --git a/src/libcamera/media_device.cpp b/src/libcamera/media_device.cpp
index 2949816b..eaa2fdb0 100644
--- a/src/libcamera/media_device.cpp
+++ b/src/libcamera/media_device.cpp
@@ -159,12 +159,12 @@ bool MediaDevice::lock()
  *
  * \sa lock()
  */
-void MediaDevice::unlock()
+bool MediaDevice::unlock()
 {
 	if (!fd_.isValid())
-		return;
+		return false;
 
-	lockf(fd_.get(), F_ULOCK, 0);
+	return lockf(fd_.get(), F_ULOCK, 0) == 0;
 }
 
 /**
