1
0
Fork 0

staging: bcm2835-camera: handle wait_for_completion_timeout return properly

[ Upstream commit 5b70084f6c ]

wait_for_completion_timeout returns unsigned long not int so a variable of
proper type is introduced. Further the check for <= 0 is ambiguous and
should be == 0 here indicating timeout.

Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
Fixes: 7b3ad5abf0 ("staging: Import the BCM2835 MMAL-based V4L2 camera driver.")
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
pull/10/head
Nicholas Mc Guire 2018-07-21 13:31:24 +02:00 committed by Greg Kroah-Hartman
parent f313b0593d
commit f80c5cf3de
1 changed files with 4 additions and 3 deletions

View File

@ -580,6 +580,7 @@ static int start_streaming(struct vb2_queue *vq, unsigned int count)
static void stop_streaming(struct vb2_queue *vq)
{
int ret;
unsigned long timeout;
struct bm2835_mmal_dev *dev = vb2_get_drv_priv(vq);
v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, "%s: dev:%p\n",
@ -605,10 +606,10 @@ static void stop_streaming(struct vb2_queue *vq)
sizeof(dev->capture.frame_count));
/* wait for last frame to complete */
ret = wait_for_completion_timeout(&dev->capture.frame_cmplt, HZ);
if (ret <= 0)
timeout = wait_for_completion_timeout(&dev->capture.frame_cmplt, HZ);
if (timeout == 0)
v4l2_err(&dev->v4l2_dev,
"error %d waiting for frame completion\n", ret);
"timed out waiting for frame completion\n");
v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev,
"disabling connection\n");