From patchwork Wed Jun 10 11:07:08 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: 6578651 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 878A19F1C1 for ; Wed, 10 Jun 2015 11:21:46 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8A8FA205FA for ; Wed, 10 Jun 2015 11:21:45 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 9BDC5205F5 for ; Wed, 10 Jun 2015 11:21:44 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id DB2646E13A; Wed, 10 Jun 2015 04:21:42 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org X-Greylist: delayed 375 seconds by postgrey-1.34 at gabe; Wed, 10 Jun 2015 04:21:40 PDT Received: from www.osadl.org (www.osadl.org [62.245.132.105]) by gabe.freedesktop.org (Postfix) with ESMTP id 4BE6D6E13A for ; Wed, 10 Jun 2015 04:21:40 -0700 (PDT) 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 t5ABFDr9024075; Wed, 10 Jun 2015 13:15:13 +0200 From: Nicholas Mc Guire To: Russell King Subject: [PATCH] DRM: Armada: fixup wait_event_timeout being ignored Date: Wed, 10 Jun 2015 13:07:08 +0200 Message-Id: <1433934428-21980-1-git-send-email-hofrat@osadl.org> X-Mailer: git-send-email 1.7.10.4 X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org Cc: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Nicholas Mc Guire X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP event API conformance testing with coccinelle spatches are being used to locate API usage inconsistencies this triggert with: ./drivers/gpu/drm/armada/armada_overlay.c:153 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 was effectively ignoring the timeout event - this looks like a bug. An appropriately named variable of type long is inserted and the call fixed up as well as the negative return check changed to detect the timeout event. Signed-off-by: Nicholas Mc Guire --- The calling side seems to assume 0 as success and <0 as error so returning -ETIME should be fine here. Patch was compile tested with imx_v6_v7_defconfig + CONFIG_DRM_ARMADA=m Patch is against 4.1-rc7 (localversion-next is -next-20150609) drivers/gpu/drm/armada/armada_overlay.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/armada/armada_overlay.c b/drivers/gpu/drm/armada/armada_overlay.c index c5b06fd..f308949 100644 --- a/drivers/gpu/drm/armada/armada_overlay.c +++ b/drivers/gpu/drm/armada/armada_overlay.c @@ -107,7 +107,7 @@ armada_plane_update(struct drm_plane *plane, struct drm_crtc *crtc, struct armada_crtc *dcrtc = drm_to_armada_crtc(crtc); uint32_t val, ctrl0; unsigned idx = 0; - int ret; + long time_left; crtc_w = armada_limit(crtc_x, crtc_w, dcrtc->crtc.mode.hdisplay); crtc_h = armada_limit(crtc_y, crtc_h, dcrtc->crtc.mode.vdisplay); @@ -150,11 +150,11 @@ armada_plane_update(struct drm_plane *plane, struct drm_crtc *crtc, dcrtc->base + LCD_SPU_SRAM_PARA1); } - ret = wait_event_timeout(dplane->vbl.wait, - list_empty(&dplane->vbl.update.node), - HZ/25); - if (ret < 0) - return ret; + time_left = wait_event_timeout(dplane->vbl.wait, + list_empty(&dplane->vbl.update.node), + HZ / 25); + if (time_left == 0) + return -ETIME; if (plane->fb != fb) { struct armada_gem_object *obj = drm_fb_obj(fb);