diff mbox

[2/3] drm: reset ELD if NULL edid is passed to drm_edid_to_eld

Message ID 52d10c0d908a51a9d71a06fc1a7ebb2d565b7689.1487241304.git.jani.nikula@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jani Nikula Feb. 16, 2017, 10:36 a.m. UTC
Make the function useful for resetting, not just setting, the ELD.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 drivers/gpu/drm/drm_edid.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Ville Syrjälä Feb. 16, 2017, 3:36 p.m. UTC | #1
On Thu, Feb 16, 2017 at 12:36:43PM +0200, Jani Nikula wrote:
> Make the function useful for resetting, not just setting, the ELD.
> 
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
> ---
>  drivers/gpu/drm/drm_edid.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
> index 24e7b282f16c..362036360724 100644
> --- a/drivers/gpu/drm/drm_edid.c
> +++ b/drivers/gpu/drm/drm_edid.c
> @@ -3430,6 +3430,9 @@ void drm_edid_to_eld(struct drm_connector *connector, struct edid *edid)
>  
>  	memset(eld, 0, sizeof(connector->eld));
>  
> +	if (!edid)
> +		return;
> +
>  	connector->latency_present[0] = false;
>  	connector->latency_present[1] = false;
>  	connector->video_latency[0] = 0;

/me thinks the check should be after all these.

Hmm. Actually the cea ext block check below should be safe wrt.
edid==NULL, so not sure we need this at all.
Jani Nikula Feb. 17, 2017, 2:02 p.m. UTC | #2
On Thu, 16 Feb 2017, Ville Syrjälä <ville.syrjala@linux.intel.com> wrote:
> On Thu, Feb 16, 2017 at 12:36:43PM +0200, Jani Nikula wrote:
>> Make the function useful for resetting, not just setting, the ELD.
>> 
>> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
>> ---
>>  drivers/gpu/drm/drm_edid.c | 3 +++
>>  1 file changed, 3 insertions(+)
>> 
>> diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
>> index 24e7b282f16c..362036360724 100644
>> --- a/drivers/gpu/drm/drm_edid.c
>> +++ b/drivers/gpu/drm/drm_edid.c
>> @@ -3430,6 +3430,9 @@ void drm_edid_to_eld(struct drm_connector *connector, struct edid *edid)
>>  
>>  	memset(eld, 0, sizeof(connector->eld));
>>  
>> +	if (!edid)
>> +		return;
>> +
>>  	connector->latency_present[0] = false;
>>  	connector->latency_present[1] = false;
>>  	connector->video_latency[0] = 0;
>
> /me thinks the check should be after all these.

D'oh!

> Hmm. Actually the cea ext block check below should be safe wrt.
> edid==NULL, so not sure we need this at all.

I'd just like to be explicit and avoid the debug message on missing CEA
extensions if the whole EDID is missing.

BR,
Jani.
Ville Syrjälä Feb. 17, 2017, 2:06 p.m. UTC | #3
On Fri, Feb 17, 2017 at 04:02:02PM +0200, Jani Nikula wrote:
> On Thu, 16 Feb 2017, Ville Syrjälä <ville.syrjala@linux.intel.com> wrote:
> > On Thu, Feb 16, 2017 at 12:36:43PM +0200, Jani Nikula wrote:
> >> Make the function useful for resetting, not just setting, the ELD.
> >> 
> >> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
> >> ---
> >>  drivers/gpu/drm/drm_edid.c | 3 +++
> >>  1 file changed, 3 insertions(+)
> >> 
> >> diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
> >> index 24e7b282f16c..362036360724 100644
> >> --- a/drivers/gpu/drm/drm_edid.c
> >> +++ b/drivers/gpu/drm/drm_edid.c
> >> @@ -3430,6 +3430,9 @@ void drm_edid_to_eld(struct drm_connector *connector, struct edid *edid)
> >>  
> >>  	memset(eld, 0, sizeof(connector->eld));
> >>  
> >> +	if (!edid)
> >> +		return;
> >> +
> >>  	connector->latency_present[0] = false;
> >>  	connector->latency_present[1] = false;
> >>  	connector->video_latency[0] = 0;
> >
> > /me thinks the check should be after all these.
> 
> D'oh!
> 
> > Hmm. Actually the cea ext block check below should be safe wrt.
> > edid==NULL, so not sure we need this at all.
> 
> I'd just like to be explicit and avoid the debug message on missing CEA
> extensions if the whole EDID is missing.

Fair enough.
diff mbox

Patch

diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index 24e7b282f16c..362036360724 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -3430,6 +3430,9 @@  void drm_edid_to_eld(struct drm_connector *connector, struct edid *edid)
 
 	memset(eld, 0, sizeof(connector->eld));
 
+	if (!edid)
+		return;
+
 	connector->latency_present[0] = false;
 	connector->latency_present[1] = false;
 	connector->video_latency[0] = 0;