diff mbox series

[04/11] drm/i915: remove useless memset() for watermarks parameters

Message ID 20181016220133.26991-5-paulo.r.zanoni@intel.com (mailing list archive)
State New, archived
Headers show
Series More watermarks improvements | expand

Commit Message

Zanoni, Paulo R Oct. 16, 2018, 10:01 p.m. UTC
The skl_compute_plane_wm_params() already completely sets the contents
of its struct, or returns plane_visible=0 or returns an error code.
There's no need to memset() it at this point for the same reason we
don't zero-initialize it up when dealing with plane 0.

If we want to keep the memset "just to be safe", then we should also
zero initialize it when we use it for plane 0.

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
---
 drivers/gpu/drm/i915/intel_pm.c | 1 -
 1 file changed, 1 deletion(-)

Comments

Ville Syrjälä Oct. 18, 2018, 1:31 p.m. UTC | #1
On Tue, Oct 16, 2018 at 03:01:26PM -0700, Paulo Zanoni wrote:
> The skl_compute_plane_wm_params() already completely sets the contents
> of its struct, or returns plane_visible=0 or returns an error code.
> There's no need to memset() it at this point for the same reason we
> don't zero-initialize it up when dealing with plane 0.

If old garbage in the struct is OK for the luma plane then it
should be OK for chroma as well.

Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

> 
> If we want to keep the memset "just to be safe", then we should also
> zero initialize it when we use it for plane 0.
> 
> Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
> ---
>  drivers/gpu/drm/i915/intel_pm.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
> index 9043ffe40ce8..d1dd3ae408f9 100644
> --- a/drivers/gpu/drm/i915/intel_pm.c
> +++ b/drivers/gpu/drm/i915/intel_pm.c
> @@ -4972,7 +4972,6 @@ static int skl_build_pipe_wm(struct intel_crtc_state *cstate,
>  
>  		/* uv plane watermarks must also be validated for NV12/Planar */
>  		if (wm_params.is_planar) {
> -			memset(&wm_params, 0, sizeof(struct skl_wm_params));
>  			wm->is_planar = true;
>  
>  			ret = skl_compute_plane_wm_params(dev_priv, cstate,
> -- 
> 2.14.4
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
index 9043ffe40ce8..d1dd3ae408f9 100644
--- a/drivers/gpu/drm/i915/intel_pm.c
+++ b/drivers/gpu/drm/i915/intel_pm.c
@@ -4972,7 +4972,6 @@  static int skl_build_pipe_wm(struct intel_crtc_state *cstate,
 
 		/* uv plane watermarks must also be validated for NV12/Planar */
 		if (wm_params.is_planar) {
-			memset(&wm_params, 0, sizeof(struct skl_wm_params));
 			wm->is_planar = true;
 
 			ret = skl_compute_plane_wm_params(dev_priv, cstate,