[PATCH] DRM: Armada: fixup wait_event_timeout being ignored
Nicholas Mc Guire
hofrat at osadl.org
Wed Jun 10 04:07:08 PDT 2015
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 <hofrat at osadl.org>
---
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
More information about the dri-devel
mailing list