Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754198AbbFJLPe (ORCPT ); Wed, 10 Jun 2015 07:15:34 -0400 Received: from www.osadl.org ([62.245.132.105]:34323 "EHLO www.osadl.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754057AbbFJLP1 (ORCPT ); Wed, 10 Jun 2015 07:15:27 -0400 From: Nicholas Mc Guire To: Russell King Cc: David Airlie , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Nicholas Mc Guire 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 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2310 Lines: 63 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); -- 1.7.10.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/