Commit b7afce51 authored by Nicholas Mc Guire's avatar Nicholas Mc Guire Committed by Greg Kroah-Hartman

staging: bcm2835-camera: fix timeout handling in wait_for_completion_timeout

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 which is the only error case so no additional
check needed here.
Signed-off-by: default avatarNicholas Mc Guire <hofrat@osadl.org>
Fixes: 7b3ad5ab ("staging: Import the BCM2835 MMAL-based V4L2 camera driver.")
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 1ef5c960
...@@ -630,6 +630,7 @@ static int send_synchronous_mmal_msg(struct vchiq_mmal_instance *instance, ...@@ -630,6 +630,7 @@ static int send_synchronous_mmal_msg(struct vchiq_mmal_instance *instance,
{ {
struct mmal_msg_context *msg_context; struct mmal_msg_context *msg_context;
int ret; int ret;
unsigned long timeout;
/* payload size must not cause message to exceed max size */ /* payload size must not cause message to exceed max size */
if (payload_len > if (payload_len >
...@@ -668,11 +669,11 @@ static int send_synchronous_mmal_msg(struct vchiq_mmal_instance *instance, ...@@ -668,11 +669,11 @@ static int send_synchronous_mmal_msg(struct vchiq_mmal_instance *instance,
return ret; return ret;
} }
ret = wait_for_completion_timeout(&msg_context->u.sync.cmplt, 3 * HZ); timeout = wait_for_completion_timeout(&msg_context->u.sync.cmplt,
if (ret <= 0) { 3 * HZ);
pr_err("error %d waiting for sync completion\n", ret); if (timeout == 0) {
if (ret == 0) pr_err("timed out waiting for sync completion\n");
ret = -ETIME; ret = -ETIME;
/* todo: what happens if the message arrives after aborting */ /* todo: what happens if the message arrives after aborting */
release_msg_context(msg_context); release_msg_context(msg_context);
return ret; return ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment