diff options
author | Gerard Salvatella <gerard.salvatella@toradex.com> | 2018-06-22 15:24:26 +0200 |
---|---|---|
committer | Marcel Ziswiler <marcel.ziswiler@toradex.com> | 2018-06-22 17:13:08 +0200 |
commit | 6c533d394e9f65d1f2b1075a5169c8c33d623c9a (patch) | |
tree | 9a6f87cfa5b1b6f96f7932486a32fbebcfa7a9d0 | |
parent | a1bc98487cb26f230f4a52afb31a7d7c59d008c0 (diff) |
media: tegra_camera: stop capturing on errorApalis-TK1_LXDE-Image_2.8b3.111-20180626
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 <gerard.salvatella@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
-rw-r--r-- | drivers/media/platform/soc_camera/tegra_camera/common.c | 11 |
1 files changed, 10 insertions, 1 deletions
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; |