diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
index dd62dfc7..aa8d9340 100644
--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
@@ -586,6 +586,8 @@ int PipelineHandlerRPi::configure(Camera *camera, CameraConfiguration *config)
 	 * because of flips in the sensor.
 	 */
 	ret = data->isp_[Isp::Input].dev()->setFormat(&sensorFormat);
+	if (ret)
+		return ret;
 
 	/*
 	 * See which streams are requested, and route the user
