diff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp
index d88cb0bd0771e545..268de60bc7965f58 100644
--- a/src/libcamera/v4l2_videodevice.cpp
+++ b/src/libcamera/v4l2_videodevice.cpp
@@ -216,7 +216,7 @@ int V4L2BufferCache::get(const FrameBuffer &buffer)
 			use = index;
 
 		/* Try to find a cache hit by comparing the planes. */
-		if (cache_[index] == buffer) {
+		if (entry == buffer) {
 			hit = true;
 			use = index;
 			break;
