lkml.org 
[lkml]   [2018]   [Sep]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH AUTOSEL 4.14 43/67] staging: bcm2835-camera: fix timeout handling in wait_for_completion_timeout
    Date
    From: Nicholas Mc Guire <hofrat@osadl.org>

    [ Upstream commit b7afce51d95726a619743aaad8870db66dfa1479 ]

    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: Nicholas Mc Guire <hofrat@osadl.org>
    Fixes: 7b3ad5abf027 ("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>
    ---
    .../staging/vc04_services/bcm2835-camera/mmal-vchiq.c | 11 ++++++-----
    1 file changed, 6 insertions(+), 5 deletions(-)

    diff --git a/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c b/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c
    index 4360db6d4392..b3176f42c820 100644
    --- a/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c
    +++ b/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c
    @@ -834,6 +834,7 @@ static int send_synchronous_mmal_msg(struct vchiq_mmal_instance *instance,
    {
    struct mmal_msg_context *msg_context;
    int ret;
    + unsigned long timeout;

    /* payload size must not cause message to exceed max size */
    if (payload_len >
    @@ -872,11 +873,11 @@ static int send_synchronous_mmal_msg(struct vchiq_mmal_instance *instance,
    return ret;
    }

    - ret = wait_for_completion_timeout(&msg_context->u.sync.cmplt, 3 * HZ);
    - if (ret <= 0) {
    - pr_err("error %d waiting for sync completion\n", ret);
    - if (ret == 0)
    - ret = -ETIME;
    + timeout = wait_for_completion_timeout(&msg_context->u.sync.cmplt,
    + 3 * HZ);
    + if (timeout == 0) {
    + pr_err("timed out waiting for sync completion\n");
    + ret = -ETIME;
    /* todo: what happens if the message arrives after aborting */
    release_msg_context(msg_context);
    return ret;
    --
    2.17.1
    \
     
     \ /
      Last update: 2018-09-07 02:51    [W:3.416 / U:0.332 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site