diff mbox

[2/3] drm/i915/dp: use drm_edid_duplicate

Message ID 1380283709-30572-2-git-send-email-jani.nikula@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jani Nikula Sept. 27, 2013, 12:08 p.m. UTC
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 drivers/gpu/drm/i915/intel_dp.c |    8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

Comments

Dave Airlie Oct. 1, 2013, 12:33 a.m. UTC | #1
Did you compile or boot this? I get a warning since you are using edid
uninitialised, I guess you meant to duplicate intel_connector->edid.

Dave.

>  drivers/gpu/drm/i915/intel_dp.c |    8 +-------
>  1 file changed, 1 insertion(+), 7 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
> index 95a3159..aed9d67 100644
> --- a/drivers/gpu/drm/i915/intel_dp.c
> +++ b/drivers/gpu/drm/i915/intel_dp.c
> @@ -2920,18 +2920,12 @@ intel_dp_get_edid(struct drm_connector *connector, struct i2c_adapter *adapter)
>         /* use cached edid if we have one */
>         if (intel_connector->edid) {
>                 struct edid *edid;
> -               int size;
>
>                 /* invalid edid */
>                 if (IS_ERR(intel_connector->edid))
>                         return NULL;
>
> -               size = (intel_connector->edid->extensions + 1) * EDID_LENGTH;
> -               edid = kmemdup(intel_connector->edid, size, GFP_KERNEL);
> -               if (!edid)
> -                       return NULL;
> -
> -               return edid;
> +               return drm_edid_duplicate(edid);
>         }
>
>         return drm_get_edid(connector, adapter);
> --
> 1.7.9.5
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Jani Nikula Oct. 1, 2013, 7:37 a.m. UTC | #2
On Tue, 01 Oct 2013, Dave Airlie <airlied@gmail.com> wrote:
> Did you compile or boot this? I get a warning since you are using edid
> uninitialised, I guess you meant to duplicate intel_connector->edid.

Hi Dave, quite embarrassing, I thought I did, obviously didn't. Updated
patch follows.


BR,
Jani.


>
> Dave.
>
>>  drivers/gpu/drm/i915/intel_dp.c |    8 +-------
>>  1 file changed, 1 insertion(+), 7 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
>> index 95a3159..aed9d67 100644
>> --- a/drivers/gpu/drm/i915/intel_dp.c
>> +++ b/drivers/gpu/drm/i915/intel_dp.c
>> @@ -2920,18 +2920,12 @@ intel_dp_get_edid(struct drm_connector *connector, struct i2c_adapter *adapter)
>>         /* use cached edid if we have one */
>>         if (intel_connector->edid) {
>>                 struct edid *edid;
>> -               int size;
>>
>>                 /* invalid edid */
>>                 if (IS_ERR(intel_connector->edid))
>>                         return NULL;
>>
>> -               size = (intel_connector->edid->extensions + 1) * EDID_LENGTH;
>> -               edid = kmemdup(intel_connector->edid, size, GFP_KERNEL);
>> -               if (!edid)
>> -                       return NULL;
>> -
>> -               return edid;
>> +               return drm_edid_duplicate(edid);
>>         }
>>
>>         return drm_get_edid(connector, adapter);
>> --
>> 1.7.9.5
>>
>> _______________________________________________
>> Intel-gfx mailing list
>> Intel-gfx@lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index 95a3159..aed9d67 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -2920,18 +2920,12 @@  intel_dp_get_edid(struct drm_connector *connector, struct i2c_adapter *adapter)
 	/* use cached edid if we have one */
 	if (intel_connector->edid) {
 		struct edid *edid;
-		int size;
 
 		/* invalid edid */
 		if (IS_ERR(intel_connector->edid))
 			return NULL;
 
-		size = (intel_connector->edid->extensions + 1) * EDID_LENGTH;
-		edid = kmemdup(intel_connector->edid, size, GFP_KERNEL);
-		if (!edid)
-			return NULL;
-
-		return edid;
+		return drm_edid_duplicate(edid);
 	}
 
 	return drm_get_edid(connector, adapter);