[RESEND 1/3] drm: fsl-dcu: Fix no fb check bug

Dongsheng Wang dongsheng.wang at freescale.com
Tue Dec 1 00:15:49 PST 2015


From: Jianwei Wang <jianwei.wang.chn at gmail.com>

For state->fb may be NULL in fsl_dcu_drm_plane_atomic_check function,
if so, return -EINVAL. No need check in fsl_dcu_drm_plane_atomic_update
anymore.

Signed-off-by: Jianwei Wang <jianwei.wang.chn at gmail.com>
Signed-off-by: Yi Meng <b56799 at freescale.com>
Signed-off-by: Wang Dongsheng <dongsheng.wang at freescale.com>
Tested-by: Stefan Agner <stefan at agner.ch>

diff --git a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_plane.c b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_plane.c
index 51daaea..a8932a8 100644
--- a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_plane.c
+++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_plane.c
@@ -41,6 +41,9 @@ static int fsl_dcu_drm_plane_atomic_check(struct drm_plane *plane,
 {
 	struct drm_framebuffer *fb = state->fb;
 
+	if (!fb)
+		return -EINVAL;
+
 	switch (fb->pixel_format) {
 	case DRM_FORMAT_RGB565:
 	case DRM_FORMAT_RGB888:
@@ -85,9 +88,6 @@ static void fsl_dcu_drm_plane_atomic_update(struct drm_plane *plane,
 	unsigned int alpha, bpp;
 	int index, ret;
 
-	if (!fb)
-		return;
-
 	index = fsl_dcu_drm_plane_index(plane);
 	if (index < 0)
 		return;
-- 
2.1.0.27.g96db324



More information about the dri-devel mailing list