From 6c533d394e9f65d1f2b1075a5169c8c33d623c9a Mon Sep 17 00:00:00 2001 From: Gerard Salvatella Date: Fri, 22 Jun 2018 15:24:26 +0200 Subject: media: tegra_camera: stop capturing on error Kernel hangs if camera capture errors are not handled to allow for a way out of the the capture thread. Signed-off-by: Gerard Salvatella Acked-by: Marcel Ziswiler --- drivers/media/platform/soc_camera/tegra_camera/common.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/soc_camera/tegra_camera/common.c b/drivers/media/platform/soc_camera/tegra_camera/common.c index 762c95724609..80f9b71c503d 100644 --- a/drivers/media/platform/soc_camera/tegra_camera/common.c +++ b/drivers/media/platform/soc_camera/tegra_camera/common.c @@ -247,6 +247,7 @@ static int tegra_camera_kthread_capture_start(void *data) { struct tegra_camera_dev *cam = data; struct tegra_camera_buffer *buf; + int err; while (1) { try_to_freeze(); @@ -268,7 +269,15 @@ static int tegra_camera_kthread_capture_start(void *data) list_del_init(&buf->queue); spin_unlock(&cam->capture_lock); - tegra_camera_capture_frame(cam, buf); + err = tegra_camera_capture_frame(cam, buf); + if (err) { + dev_err(&cam->ndev->dev, "Error capturing frame. Stopping capture"); + + wait_event_interruptible(cam->capture_start_wait, + kthread_should_stop()); + if (kthread_should_stop()) + break; + } } return 0; -- cgit v1.2.3