[PATCH] drm/i915: Fix missing check for return value of dev_get_platdata()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The dev_get_platdata() function may return NULL, which may
cause null pointer deference, and most other callsites of
dev_get_platdata() do Null check. Add Null check for return
value of dev_get_platdata().

Found by our static analysis tool.

Signed-off-by: Chenyuan Mi <cymi20@xxxxxxxxxxxx>
---
 drivers/gpu/drm/i915/display/intel_lpe_audio.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/i915/display/intel_lpe_audio.c b/drivers/gpu/drm/i915/display/intel_lpe_audio.c
index 5863763de530..a1655ddbe910 100644
--- a/drivers/gpu/drm/i915/display/intel_lpe_audio.c
+++ b/drivers/gpu/drm/i915/display/intel_lpe_audio.c
@@ -336,6 +336,9 @@ void intel_lpe_audio_notify(struct drm_i915_private *dev_priv,
 		return;
 
 	pdata = dev_get_platdata(&dev_priv->display.audio.lpe.platdev->dev);
+	if (!pdata)
+		return;
+
 	ppdata = &pdata->port[port - PORT_B];
 
 	spin_lock_irqsave(&pdata->lpe_audio_slock, irqflags);
-- 
2.17.1




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux