drm: rcar-du: Fix hardware plane allocation
authorLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Wed, 25 Feb 2015 16:38:25 +0000 (18:38 +0200)
committerLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Tue, 3 Mar 2015 14:16:09 +0000 (16:16 +0200)
The hardware plane allocator loops over all planes to find free
candidates. However, instead of looping over the number of hardware
planes, it loops over the number of software planes, which happens to be
larger by one unit. This has no effect in practise as the extra plane is
always cleared in the mask of free planes, but it should still be fixed
for correctness.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
drivers/gpu/drm/rcar-du/rcar_du_plane.c

index 242db1e1a1e49467927c4f212b176c4aae9cffa7..4a0669fd81767b9868b5b35d66f9c3166e509681 100644 (file)
@@ -54,7 +54,7 @@ int rcar_du_plane_reserve(struct rcar_du_plane *plane,
 
        mutex_lock(&rgrp->planes.lock);
 
-       for (i = 0; i < ARRAY_SIZE(rgrp->planes.planes); ++i) {
+       for (i = 0; i < RCAR_DU_NUM_HW_PLANES; ++i) {
                if (!(rgrp->planes.free & (1 << i)))
                        continue;
 
@@ -63,7 +63,7 @@ int rcar_du_plane_reserve(struct rcar_du_plane *plane,
                        break;
        }
 
-       if (i == ARRAY_SIZE(rgrp->planes.planes))
+       if (i == RCAR_DU_NUM_HW_PLANES)
                goto done;
 
        rgrp->planes.free &= ~(1 << i);