From patchwork Wed Jun 10 09:02:03 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Mc Guire X-Patchwork-Id: 30155 X-Patchwork-Delegate: sylvester.nawrocki@gmail.com Received: from mail.tu-berlin.de ([130.149.7.33]) by www.linuxtv.org with esmtp (Exim 4.72) (envelope-from ) id 1Z2c3B-0004yu-J7; Wed, 10 Jun 2015 11:11:57 +0200 X-tubIT-Incoming-IP: 209.132.180.67 Received: from vger.kernel.org ([209.132.180.67]) by mail.tu-berlin.de (exim-4.76/mailfrontend-6) with esmtp id 1Z2c39-0001ba-5P; Wed, 10 Jun 2015 11:11:57 +0200 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933539AbbFJJKy (ORCPT + 1 other); Wed, 10 Jun 2015 05:10:54 -0400 Received: from www.osadl.org ([62.245.132.105]:33522 "EHLO www.osadl.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933501AbbFJJKv (ORCPT ); Wed, 10 Jun 2015 05:10:51 -0400 Received: from debian.hofr.at (92-243-35-153.adsl.nanet.at [92.243.35.153] (may be forged)) by www.osadl.org (8.13.8/8.13.8/OSADL-2007092901) with ESMTP id t5A9A1cj012683; Wed, 10 Jun 2015 11:10:01 +0200 From: Nicholas Mc Guire To: Kyungmin Park Cc: Tomasz Stanislawski , Mauro Carvalho Chehab , linux-arm-kernel@lists.infradead.org, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Nicholas Mc Guire Subject: [PATCH] [media] s5p-tv: fix wait_event_timeout return handling Date: Wed, 10 Jun 2015 11:02:03 +0200 Message-Id: <1433926923-13092-1-git-send-email-hofrat@osadl.org> X-Mailer: git-send-email 1.7.10.4 X-Spam-Status: No, score=-0.9 required=5.0 tests=BAYES_00, KHOP_SC_TOP_CIDR8, RDNS_DYNAMIC autolearn=no version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on www.osadl.org Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-PMX-Version: 6.0.0.2142326, Antispam-Engine: 2.7.2.2107409, Antispam-Data: 2015.6.10.90615 X-PMX-Spam: Gauge=IIIIIIII, Probability=8%, Report=' MULTIPLE_RCPTS 0.1, HTML_00_01 0.05, HTML_00_10 0.05, BODYTEXTP_SIZE_3000_LESS 0, BODY_SIZE_2000_2999 0, BODY_SIZE_5000_LESS 0, BODY_SIZE_7000_LESS 0, FROM_NAME_PHRASE 0, URI_ENDS_IN_HTML 0, __ANY_URI 0, __CP_URI_IN_BODY 0, __HAS_FROM 0, __HAS_MSGID 0, __HAS_X_MAILER 0, __HAS_X_MAILING_LIST 0, __INT_PROD_TV 0, __MIME_TEXT_ONLY 0, __MULTIPLE_RCPTS_CC_X2 0, __SANE_MSGID 0, __SUBJ_ALPHA_END 0, __TO_MALFORMED_2 0, __URI_NO_WWW 0, __URI_NS ' event API conformance testing with coccinelle spatches are being used to locate API usage inconsistencies this triggert with: ./drivers/media/platform/s5p-tv/mixer_reg.c:364 incorrect check for negative return Return type of wait_event_timeout is signed long not int and the return type is >=0 always thus the negative check is unnecessary. An appropriately named variable of type long is inserted and the call fixed up aswell as the negative return check dropped. Signed-off-by: Nicholas Mc Guire --- Minor change of indentation to make checkpatch happy - not sure if this is much more readable though. Patch was compile tested with exynos_defconfig + CONFIG_MEDIA_SUPPORT=m, CONFIG_MEDIA_CAMERA_SUPPORT=y, CONFIG_MEDIA_ANALOG_TV_SUPPORT=y, CONFIG_V4L_PLATFORM_DRIVERS=y, CONFIG_VIDEO_SAMSUNG_S5P_TV=y, CONFIG_VIDEO_SAMSUNG_S5P_MIXER=m Patch is against 4.1-rc7 (localversion-next is -next-20150609) drivers/media/platform/s5p-tv/mixer_reg.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/drivers/media/platform/s5p-tv/mixer_reg.c b/drivers/media/platform/s5p-tv/mixer_reg.c index b713403..5127acb 100644 --- a/drivers/media/platform/s5p-tv/mixer_reg.c +++ b/drivers/media/platform/s5p-tv/mixer_reg.c @@ -357,17 +357,15 @@ void mxr_reg_streamoff(struct mxr_device *mdev) int mxr_reg_wait4vsync(struct mxr_device *mdev) { - int ret; + long time_left; clear_bit(MXR_EVENT_VSYNC, &mdev->event_flags); /* TODO: consider adding interruptible */ - ret = wait_event_timeout(mdev->event_queue, - test_bit(MXR_EVENT_VSYNC, &mdev->event_flags), - msecs_to_jiffies(1000)); - if (ret > 0) + time_left = wait_event_timeout(mdev->event_queue, + test_bit(MXR_EVENT_VSYNC, &mdev->event_flags), + msecs_to_jiffies(1000)); + if (time_left > 0) return 0; - if (ret < 0) - return ret; mxr_warn(mdev, "no vsync detected - timeout\n"); return -ETIME; }