linux-arm-msm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/msm: potential error pointer dereference in init()
@ 2021-10-04 10:38 Dan Carpenter
  2021-10-04 23:33 ` abhinavk
  2021-10-04 23:35 ` Dmitry Baryshkov
  0 siblings, 2 replies; 3+ messages in thread
From: Dan Carpenter @ 2021-10-04 10:38 UTC (permalink / raw)
  To: Rob Clark, Jordan Crouse
  Cc: Sean Paul, David Airlie, Daniel Vetter, Dmitry Baryshkov,
	Abhinav Kumar, Viresh Kumar, Bjorn Andersson, Kalyan Thota,
	Xu Wang, Jonathan Marek, Yangtao Li, linux-arm-msm, dri-devel,
	freedreno, kernel-janitors

The msm_iommu_new() returns error pointers on failure so check for that
to avoid an Oops.

Fixes: ccac7ce373c1 ("drm/msm: Refactor address space initialization")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
index ae48f41821cf..ad247c06e198 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
@@ -908,6 +908,10 @@ static int _dpu_kms_mmu_init(struct dpu_kms *dpu_kms)
 		return 0;
 
 	mmu = msm_iommu_new(dpu_kms->dev->dev, domain);
+	if (IS_ERR(mmu)) {
+		iommu_domain_free(domain);
+		return PTR_ERR(mmu);
+	}
 	aspace = msm_gem_address_space_create(mmu, "dpu1",
 		0x1000, 0x100000000 - 0x1000);
 
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-10-04 23:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-04 10:38 [PATCH] drm/msm: potential error pointer dereference in init() Dan Carpenter
2021-10-04 23:33 ` abhinavk
2021-10-04 23:35 ` Dmitry Baryshkov

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).