Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2500380imm; Mon, 24 Sep 2018 05:32:03 -0700 (PDT) X-Google-Smtp-Source: ACcGV62mJ3oe+eOuXpkYUbb8G+0ssd40nQaGaEwWCPAHPpDA/t/WmsXw3HPD3BD94gYK6IOLKJDW X-Received: by 2002:a63:f51:: with SMTP id 17-v6mr9457892pgp.100.1537792323685; Mon, 24 Sep 2018 05:32:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537792323; cv=none; d=google.com; s=arc-20160816; b=t7OafJ/5fXtkdKEdTN0VTjiae/GexoKPBOgJlHqBO6ZUZlsLiES48xx3p4iLmuuRRf zlMSJLlridDYnpcribux8ktQt6aE90J0hVCfH8xRzSPBg6YKgzo3+py2oftY4tLVEgVA pbFe0fn1b3Zo5viyy46QtyuaGeAbBgOYcR31elmtGG6JHMuJjPMQh5p/FltQoFUfINXu y8+Wz0YJqRICfC7CWr/QhjpOsQQvD/qYz5eV2Co8qNkL/S0NdRMtoSOxULmZbaE8Awww foBvew/AKzx55A9f23KxRNJA8zG20hAcsEzSMtDWXVqa6pDK8jFEDNK3Yt9xvIYNBa0c sC9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from; bh=YgkasRXL53XtPamNsk1fyZV7d3x+4NcmiFQMxy7ndYQ=; b=iWzVHtltUTygS9NliBEHsrhzB5uBAXzIQMoUP/rDnG+hKp3n+tOLfetYFCY3AVL8fd 7AdrCol/JG+kFwtJYfvzqHDjQjVAwtm9NhX1rDVOxIfWPsq3sRH4NUWjyucd6omhjXMB UTaLSQ1rErtbNnYvw1yGmN6wfHfrA/SRCp+fP3QgxX43QVBgDMhESRl2tEgI0iXrJQLE oh9HiXi1SglskpfKdWAunpmlFDUVJPHuT3ppnuUqxsPQem/vzBmv+I13B2nRlxGNK2wU kQ6DqIcbDPNhCU8C4Rw4pKXFhHVL0JTLXuq4SKbNFAYM+P9zoHe4UWlqhNS9/Dn4jR8X Gw4w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c27-v6si3131692pgc.461.2018.09.24.05.31.48; Mon, 24 Sep 2018 05:32:03 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387827AbeIXSch (ORCPT + 99 others); Mon, 24 Sep 2018 14:32:37 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:57850 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730894AbeIXSch (ORCPT ); Mon, 24 Sep 2018 14:32:37 -0400 Received: from localhost (ip-213-127-77-73.ip.prioritytelecom.net [213.127.77.73]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 0E4A51099; Mon, 24 Sep 2018 12:30:41 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nicholas Mc Guire , Sasha Levin Subject: [PATCH 4.18 066/235] staging: bcm2835-camera: fix timeout handling in wait_for_completion_timeout Date: Mon, 24 Sep 2018 13:50:52 +0200 Message-Id: <20180924113111.828466629@linuxfoundation.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20180924113103.999624566@linuxfoundation.org> References: <20180924113103.999624566@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Nicholas Mc Guire [ 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 Fixes: 7b3ad5abf027 ("staging: Import the BCM2835 MMAL-based V4L2 camera driver.") Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) --- a/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c +++ b/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c @@ -630,6 +630,7 @@ static int send_synchronous_mmal_msg(str { struct mmal_msg_context *msg_context; int ret; + unsigned long timeout; /* payload size must not cause message to exceed max size */ if (payload_len > @@ -668,11 +669,11 @@ static int send_synchronous_mmal_msg(str 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;