Skip to content

Commit 9f4ebf6

Browse files
committed
drm/sun4i: backend: Allow a NULL plane pointer to retrieve the format
The function converting the DRM format to its equivalent in the backend registers was assuming that we were having a plane. However, we might want to use that function when setting up a plane using the frontend, in which case we will not have a plane associated to the backend's layer. Yet, we still need to setup the format to the one output by the frontend. Test for NULL plane pointers before referencing them, so that we can work around it. Reviewed-by: Neil Armstrong <[email protected]> Signed-off-by: Maxime Ripard <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/bfbe4c2e8525a7542526b648d59a8f3546e905f1.1516613040.git-series.maxime.ripard@free-electrons.com
1 parent c4c7c72 commit 9f4ebf6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/gpu/drm/sun4i/sun4i_backend.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ void sun4i_backend_layer_enable(struct sun4i_backend *backend,
9393
static int sun4i_backend_drm_format_to_layer(struct drm_plane *plane,
9494
u32 format, u32 *mode)
9595
{
96-
if ((plane->type == DRM_PLANE_TYPE_PRIMARY) &&
96+
if (plane && (plane->type == DRM_PLANE_TYPE_PRIMARY) &&
9797
(format == DRM_FORMAT_ARGB8888))
9898
format = DRM_FORMAT_XRGB8888;
9999

0 commit comments

Comments
 (0)