[09/10] drm/i915: Do not free the passed EDID in intel_connector_update_modes()
diff mbox

Message ID 972d909d85abf63d546496ecc73e9ed123f163ba.1350644022.git.jani.nikula@intel.com
State New, archived
Headers show

Commit Message

Jani Nikula Oct. 19, 2012, 11:51 a.m. UTC
The caller, not intel_connector_update_modes(), should free the edid. This
improves the reusability of intel_connector_update_modes().

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 drivers/gpu/drm/i915/intel_crt.c   |    6 +++++-
 drivers/gpu/drm/i915/intel_modes.c |    7 +++++--
 2 files changed, 10 insertions(+), 3 deletions(-)

Comments

Jesse Barnes Oct. 19, 2012, 5:10 p.m. UTC | #1
On Fri, 19 Oct 2012 14:51:51 +0300
Jani Nikula <jani.nikula@intel.com> wrote:

> The caller, not intel_connector_update_modes(), should free the edid. This
> improves the reusability of intel_connector_update_modes().
> 
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
> ---
>  drivers/gpu/drm/i915/intel_crt.c   |    6 +++++-
>  drivers/gpu/drm/i915/intel_modes.c |    7 +++++--
>  2 files changed, 10 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_crt.c b/drivers/gpu/drm/i915/intel_crt.c
> index 53f3e87..35c92d5 100644
> --- a/drivers/gpu/drm/i915/intel_crt.c
> +++ b/drivers/gpu/drm/i915/intel_crt.c
> @@ -419,12 +419,16 @@ static int intel_crt_ddc_get_modes(struct drm_connector *connector,
>  				struct i2c_adapter *adapter)
>  {
>  	struct edid *edid;
> +	int ret;
>  
>  	edid = intel_crt_get_edid(connector, adapter);
>  	if (!edid)
>  		return 0;
>  
> -	return intel_connector_update_modes(connector, edid);
> +	ret = intel_connector_update_modes(connector, edid);
> +	kfree(edid);
> +
> +	return ret;
>  }
>  
>  static bool intel_crt_detect_ddc(struct drm_connector *connector)
> diff --git a/drivers/gpu/drm/i915/intel_modes.c b/drivers/gpu/drm/i915/intel_modes.c
> index 1773fb8..b57dbbe 100644
> --- a/drivers/gpu/drm/i915/intel_modes.c
> +++ b/drivers/gpu/drm/i915/intel_modes.c
> @@ -44,7 +44,6 @@ int intel_connector_update_modes(struct drm_connector *connector,
>  	drm_mode_connector_update_edid_property(connector, edid);
>  	ret = drm_add_edid_modes(connector, edid);
>  	drm_edid_to_eld(connector, edid);
> -	kfree(edid);
>  
>  	return ret;
>  }
> @@ -60,12 +59,16 @@ int intel_ddc_get_modes(struct drm_connector *connector,
>  			struct i2c_adapter *adapter)
>  {
>  	struct edid *edid;
> +	int ret;
>  
>  	edid = drm_get_edid(connector, adapter);
>  	if (!edid)
>  		return 0;
>  
> -	return intel_connector_update_modes(connector, edid);
> +	ret = intel_connector_update_modes(connector, edid);
> +	kfree(edid);
> +
> +	return ret;
>  }
>  
>  static const struct drm_prop_enum_list force_audio_names[] = {

Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>

Patch
diff mbox

diff --git a/drivers/gpu/drm/i915/intel_crt.c b/drivers/gpu/drm/i915/intel_crt.c
index 53f3e87..35c92d5 100644
--- a/drivers/gpu/drm/i915/intel_crt.c
+++ b/drivers/gpu/drm/i915/intel_crt.c
@@ -419,12 +419,16 @@  static int intel_crt_ddc_get_modes(struct drm_connector *connector,
 				struct i2c_adapter *adapter)
 {
 	struct edid *edid;
+	int ret;
 
 	edid = intel_crt_get_edid(connector, adapter);
 	if (!edid)
 		return 0;
 
-	return intel_connector_update_modes(connector, edid);
+	ret = intel_connector_update_modes(connector, edid);
+	kfree(edid);
+
+	return ret;
 }
 
 static bool intel_crt_detect_ddc(struct drm_connector *connector)
diff --git a/drivers/gpu/drm/i915/intel_modes.c b/drivers/gpu/drm/i915/intel_modes.c
index 1773fb8..b57dbbe 100644
--- a/drivers/gpu/drm/i915/intel_modes.c
+++ b/drivers/gpu/drm/i915/intel_modes.c
@@ -44,7 +44,6 @@  int intel_connector_update_modes(struct drm_connector *connector,
 	drm_mode_connector_update_edid_property(connector, edid);
 	ret = drm_add_edid_modes(connector, edid);
 	drm_edid_to_eld(connector, edid);
-	kfree(edid);
 
 	return ret;
 }
@@ -60,12 +59,16 @@  int intel_ddc_get_modes(struct drm_connector *connector,
 			struct i2c_adapter *adapter)
 {
 	struct edid *edid;
+	int ret;
 
 	edid = drm_get_edid(connector, adapter);
 	if (!edid)
 		return 0;
 
-	return intel_connector_update_modes(connector, edid);
+	ret = intel_connector_update_modes(connector, edid);
+	kfree(edid);
+
+	return ret;
 }
 
 static const struct drm_prop_enum_list force_audio_names[] = {