[Intel-gfx] [PATCH] drm/i915: add audio_ptr pointer check

libin.yang at linux.intel.com libin.yang at linux.intel.com
Wed Mar 2 02:24:31 UTC 2016


From: Libin Yang <libin.yang at linux.intel.com>

check to make sure audio_ptr is not NULL before
using it.

Signed-off-by: Libin Yang <libin.yang at linux.intel.com>
---
 drivers/gpu/drm/i915/intel_audio.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_audio.c b/drivers/gpu/drm/i915/intel_audio.c
index 31f6d21..667596d 100644
--- a/drivers/gpu/drm/i915/intel_audio.c
+++ b/drivers/gpu/drm/i915/intel_audio.c
@@ -529,7 +529,8 @@ void intel_audio_codec_enable(struct intel_encoder *intel_encoder)
 	intel_dig_port->audio_connector = connector;
 	mutex_unlock(&dev_priv->av_mutex);
 
-	if (acomp && acomp->audio_ops && acomp->audio_ops->pin_eld_notify)
+	if (acomp && acomp->audio_ops && acomp->audio_ops->pin_eld_notify &&
+	    acomp->audio_ops->audio_ptr)
 		acomp->audio_ops->pin_eld_notify(acomp->audio_ops->audio_ptr, (int) port);
 }
 
@@ -556,7 +557,8 @@ void intel_audio_codec_disable(struct intel_encoder *intel_encoder)
 	intel_dig_port->audio_connector = NULL;
 	mutex_unlock(&dev_priv->av_mutex);
 
-	if (acomp && acomp->audio_ops && acomp->audio_ops->pin_eld_notify)
+	if (acomp && acomp->audio_ops && acomp->audio_ops->pin_eld_notify &&
+	    acomp->audio_ops->audio_ptr)
 		acomp->audio_ops->pin_eld_notify(acomp->audio_ops->audio_ptr, (int) port);
 }
 
-- 
1.9.1



More information about the Intel-gfx mailing list