]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
drm/sun4i: Add end of list element for sun4i_layers_init's returned list
authorChen-Yu Tsai <wens@csie.org>
Thu, 23 Feb 2017 08:05:35 +0000 (16:05 +0800)
committerMaxime Ripard <maxime.ripard@free-electrons.com>
Tue, 7 Mar 2017 21:15:16 +0000 (22:15 +0100)
The number of defined planes in sun4i_layer is unknown to other parts
of the sun4i drm driver. Since the return value of sun4i_layers_init
is a list of layers, make it return 1 more empty layer as an end of
list guard value.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
drivers/gpu/drm/sun4i/sun4i_layer.c

index 41bc0f860f5c0d68be8c719adfb112066e5d8af9..0b703fb026569733781e2973fdba4a1e9b8594ff 100644 (file)
@@ -139,7 +139,7 @@ struct sun4i_layer **sun4i_layers_init(struct drm_device *drm)
        struct sun4i_layer **layers;
        int i;
 
-       layers = devm_kcalloc(drm->dev, ARRAY_SIZE(sun4i_backend_planes),
+       layers = devm_kcalloc(drm->dev, ARRAY_SIZE(sun4i_backend_planes) + 1,
                              sizeof(*layers), GFP_KERNEL);
        if (!layers)
                return ERR_PTR(-ENOMEM);