linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/i915: Fix missing check for return value of dev_get_platdata()
@ 2023-06-14 15:56 Chenyuan Mi
  0 siblings, 0 replies; only message in thread
From: Chenyuan Mi @ 2023-06-14 15:56 UTC (permalink / raw)
  To: jani.nikula
  Cc: joonas.lahtinen, rodrigo.vivi, tvrtko.ursulin, airlied, daniel,
	ville.syrjala, andi.shyti, andrzej.hajda, lucas.demarchi,
	piotr.piorkowski, intel-gfx, dri-devel, linux-kernel,
	Chenyuan Mi

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@fudan.edu.cn>
---
 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


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2023-06-14 15:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-14 15:56 [PATCH] drm/i915: Fix missing check for return value of dev_get_platdata() Chenyuan Mi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).