@@ -1021,6 +1021,8 @@ static int mmal_setup_video_component(struct bcm2835_mmal_dev *dev,
ret = vchiq_mmal_port_connect_tunnel(dev->instance,
preview_port,
NULL);
+ if (ret)
+ return ret;
}
}
preview_port->es.video.width = f->fmt.pix.width;
@@ -1153,8 +1155,10 @@ static int mmal_setup_components(struct bcm2835_mmal_dev *dev,
"vid_cap - disconnect previous tunnel\n");
/* Disconnect any previous connection */
- vchiq_mmal_port_connect_tunnel(dev->instance,
- dev->capture.camera_port, NULL);
+ ret = vchiq_mmal_port_connect_tunnel(dev->instance,
+ dev->capture.camera_port, NULL);
+ if (ret)
+ return ret;
dev->capture.camera_port = NULL;
ret = vchiq_mmal_component_disable(dev->instance,
dev->capture.encode_component);
In mmal_setup_video_component() and mmal_setup_components(), two vchiq_mmal_port_connect_tunnel() are called without proper error handling. This could lead to unnoticed failures and inconsistent behavior compared to other parts of the code. In this patch, error handlings have been added for calls to vchiq_mmal_port_connect_tunnel(), enhancing code robustness and ensuring consistent error management. Signed-off-by: Wentao Liang <vulab@iscas.ac.cn> --- .../staging/vc04_services/bcm2835-camera/bcm2835-camera.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)