diff mbox series

[2/2] drm/i915/display: Use correct method to free crtc_state

Message ID 20231010183101.704439-3-suraj.kandpal@intel.com (mailing list archive)
State New, archived
Headers show
Series Use intel_crtc_destroy state | expand

Commit Message

Kandpal, Suraj Oct. 10, 2023, 6:31 p.m. UTC
Even though there is no leaking of resource here lets
just use the correct method to free crtc_state

Fixes: 8a3b3df39757 ("drm/i915: Clean up variable names in old dpll functions")
Signed-off-by: Suraj Kandpal <suraj.kandpal@intel.com>
---
 drivers/gpu/drm/i915/display/intel_dpll.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Ville Syrjälä Oct. 11, 2023, 9:54 p.m. UTC | #1
On Wed, Oct 11, 2023 at 12:01:01AM +0530, Suraj Kandpal wrote:
> Even though there is no leaking of resource here lets
> just use the correct method to free crtc_state
> 
> Fixes: 8a3b3df39757 ("drm/i915: Clean up variable names in old dpll functions")

That is clearly not the right commit to blame here. I've
just dropped the whole fixes tag since there is nothing
real to fix here anyway.

I also dropped the fixes tag from the other patch since I
don't think that original commit would leak anything. The
potential for leaks appeared later as we got eg. gamma
readout that might allocate additional things and hang them
off the crtc state. And as the potential leak can happen
only during driver loading it's mostly harmless.

Anyways, both patches pushed now. Thanks.

> Signed-off-by: Suraj Kandpal <suraj.kandpal@intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_dpll.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_dpll.c b/drivers/gpu/drm/i915/display/intel_dpll.c
> index 2255ad651486..d41c1dc9f66c 100644
> --- a/drivers/gpu/drm/i915/display/intel_dpll.c
> +++ b/drivers/gpu/drm/i915/display/intel_dpll.c
> @@ -7,6 +7,7 @@
>  #include <linux/string_helpers.h>
>  
>  #include "i915_reg.h"
> +#include "intel_atomic.h"
>  #include "intel_crtc.h"
>  #include "intel_cx0_phy.h"
>  #include "intel_de.h"
> @@ -2006,7 +2007,7 @@ int vlv_force_pll_on(struct drm_i915_private *dev_priv, enum pipe pipe,
>  		vlv_enable_pll(crtc_state);
>  	}
>  
> -	kfree(crtc_state);
> +	intel_crtc_destroy_state(&crtc->base, &crtc_state->uapi);
>  
>  	return 0;
>  }
> -- 
> 2.25.1
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/display/intel_dpll.c b/drivers/gpu/drm/i915/display/intel_dpll.c
index 2255ad651486..d41c1dc9f66c 100644
--- a/drivers/gpu/drm/i915/display/intel_dpll.c
+++ b/drivers/gpu/drm/i915/display/intel_dpll.c
@@ -7,6 +7,7 @@ 
 #include <linux/string_helpers.h>
 
 #include "i915_reg.h"
+#include "intel_atomic.h"
 #include "intel_crtc.h"
 #include "intel_cx0_phy.h"
 #include "intel_de.h"
@@ -2006,7 +2007,7 @@  int vlv_force_pll_on(struct drm_i915_private *dev_priv, enum pipe pipe,
 		vlv_enable_pll(crtc_state);
 	}
 
-	kfree(crtc_state);
+	intel_crtc_destroy_state(&crtc->base, &crtc_state->uapi);
 
 	return 0;
 }