diff mbox series

drm/i915/sdvo: ignore returned broken edid on intel_sdvo_tmds_sink_detect

Message ID 20230803143530.27601-1-juhapekka.heikkila@gmail.com (mailing list archive)
State New, archived
Headers show
Series drm/i915/sdvo: ignore returned broken edid on intel_sdvo_tmds_sink_detect | expand

Commit Message

Juha-Pekka Heikkila Aug. 3, 2023, 2:35 p.m. UTC
If drm_edid_raw returned NULL on error don't try accessing anything behind
that NULL

Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
---
 drivers/gpu/drm/i915/display/intel_sdvo.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Jani Nikula Aug. 3, 2023, 3:24 p.m. UTC | #1
On Thu, 03 Aug 2023, Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com> wrote:
> If drm_edid_raw returned NULL on error don't try accessing anything behind
> that NULL
>
> Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>

Reviewed-by: Jani Nikula <jani.nikula@intel.com>

> ---
>  drivers/gpu/drm/i915/display/intel_sdvo.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_sdvo.c b/drivers/gpu/drm/i915/display/intel_sdvo.c
> index 8298a86d1334..065e619f934f 100644
> --- a/drivers/gpu/drm/i915/display/intel_sdvo.c
> +++ b/drivers/gpu/drm/i915/display/intel_sdvo.c
> @@ -2097,7 +2097,7 @@ intel_sdvo_tmds_sink_detect(struct drm_connector *connector)
>  		const struct edid *edid = drm_edid_raw(drm_edid);
>  
>  		/* DDC bus is shared, match EDID to connector type */
> -		if (edid->input & DRM_EDID_INPUT_DIGITAL)
> +		if (edid && edid->input & DRM_EDID_INPUT_DIGITAL)
>  			status = connector_status_connected;
>  		else
>  			status = connector_status_disconnected;
Hogander, Jouni Aug. 4, 2023, 1:17 p.m. UTC | #2
On Thu, 2023-08-03 at 18:24 +0300, Jani Nikula wrote:
> On Thu, 03 Aug 2023, Juha-Pekka Heikkila
> <juhapekka.heikkila@gmail.com> wrote:
> > If drm_edid_raw returned NULL on error don't try accessing anything
> > behind
> > that NULL
> > 
> > Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
> 
> Reviewed-by: Jani Nikula <jani.nikula@intel.com>

Thank you for the patch and the review. This is now merged.

BR,

Jouni Högander

> 
> > ---
> >  drivers/gpu/drm/i915/display/intel_sdvo.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/display/intel_sdvo.c
> > b/drivers/gpu/drm/i915/display/intel_sdvo.c
> > index 8298a86d1334..065e619f934f 100644
> > --- a/drivers/gpu/drm/i915/display/intel_sdvo.c
> > +++ b/drivers/gpu/drm/i915/display/intel_sdvo.c
> > @@ -2097,7 +2097,7 @@ intel_sdvo_tmds_sink_detect(struct
> > drm_connector *connector)
> >                 const struct edid *edid = drm_edid_raw(drm_edid);
> >  
> >                 /* DDC bus is shared, match EDID to connector type
> > */
> > -               if (edid->input & DRM_EDID_INPUT_DIGITAL)
> > +               if (edid && edid->input & DRM_EDID_INPUT_DIGITAL)
> >                         status = connector_status_connected;
> >                 else
> >                         status = connector_status_disconnected;
>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/display/intel_sdvo.c b/drivers/gpu/drm/i915/display/intel_sdvo.c
index 8298a86d1334..065e619f934f 100644
--- a/drivers/gpu/drm/i915/display/intel_sdvo.c
+++ b/drivers/gpu/drm/i915/display/intel_sdvo.c
@@ -2097,7 +2097,7 @@  intel_sdvo_tmds_sink_detect(struct drm_connector *connector)
 		const struct edid *edid = drm_edid_raw(drm_edid);
 
 		/* DDC bus is shared, match EDID to connector type */
-		if (edid->input & DRM_EDID_INPUT_DIGITAL)
+		if (edid && edid->input & DRM_EDID_INPUT_DIGITAL)
 			status = connector_status_connected;
 		else
 			status = connector_status_disconnected;