[14/24] drm/omap: dispc: disp_wb_setup to check return code

Message ID 1518428694-18018-15-git-send-email-tomi.valkeinen@ti.com
State New
Headers show
Series
  • drm/omap: misc patches
Related show

Commit Message

Tomi Valkeinen Feb. 12, 2018, 9:44 a.m.
From: Benoit Parrot <bparrot@ti.com>

When dispc_wb_setup() calls dispc_ovl_setup_common() it does not
check for failure but instead keeps on partially setting up WB.
This causes the WB H/W to be partially initialized and yield
unexpected behavior.

Make sure return code is successful before proceeding.

Signed-off-by: Benoit Parrot <bparrot@ti.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 drivers/gpu/drm/omapdrm/dss/dispc.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Laurent Pinchart Feb. 27, 2018, 1:38 p.m. | #1
Hi Tomi,

Thank you for the patch.

On Monday, 12 February 2018 11:44:44 EET Tomi Valkeinen wrote:
> From: Benoit Parrot <bparrot@ti.com>
> 
> When dispc_wb_setup() calls dispc_ovl_setup_common() it does not
> check for failure but instead keeps on partially setting up WB.
> This causes the WB H/W to be partially initialized and yield
> unexpected behavior.
> 
> Make sure return code is successful before proceeding.
> 
> Signed-off-by: Benoit Parrot <bparrot@ti.com>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> ---
>  drivers/gpu/drm/omapdrm/dss/dispc.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/dispc.c
> b/drivers/gpu/drm/omapdrm/dss/dispc.c index 679931e108f9..30bcee6580f5
> 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dispc.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dispc.c
> @@ -2678,6 +2678,8 @@ int dispc_wb_setup(const struct
> omap_dss_writeback_info *wi, wi->height, wi->fourcc, wi->rotation, zorder,
>  		wi->pre_mult_alpha, global_alpha, wi->rotation_type,
>  		replication, vm, mem_to_mem);
> +	if (r)
> +		return r;
> 
>  	switch (wi->fourcc) {
>  	case DRM_FORMAT_RGB565:
> @@ -2718,7 +2720,7 @@ int dispc_wb_setup(const struct
> omap_dss_writeback_info *wi, REG_FLD_MOD(DISPC_OVL_ATTRIBUTES2(plane),
> wbdelay, 7, 0);
>  	}
> 
> -	return r;
> +	return 0;
>  }
> 
>  static int dispc_ovl_enable(enum omap_plane_id plane, bool enable)

Patch

diff --git a/drivers/gpu/drm/omapdrm/dss/dispc.c b/drivers/gpu/drm/omapdrm/dss/dispc.c
index 679931e108f9..30bcee6580f5 100644
--- a/drivers/gpu/drm/omapdrm/dss/dispc.c
+++ b/drivers/gpu/drm/omapdrm/dss/dispc.c
@@ -2678,6 +2678,8 @@  int dispc_wb_setup(const struct omap_dss_writeback_info *wi,
 		wi->height, wi->fourcc, wi->rotation, zorder,
 		wi->pre_mult_alpha, global_alpha, wi->rotation_type,
 		replication, vm, mem_to_mem);
+	if (r)
+		return r;
 
 	switch (wi->fourcc) {
 	case DRM_FORMAT_RGB565:
@@ -2718,7 +2720,7 @@  int dispc_wb_setup(const struct omap_dss_writeback_info *wi,
 		REG_FLD_MOD(DISPC_OVL_ATTRIBUTES2(plane), wbdelay, 7, 0);
 	}
 
-	return r;
+	return 0;
 }
 
 static int dispc_ovl_enable(enum omap_plane_id plane, bool enable)