From: Sean Paul <[email protected]>

[ Upstream commit 5ca4a094ba7e1369363dcbcbde8baf06ddcdc2d1 ]

pdcptr and seqptr aren't necessarily valid, check them before trying to
unmap them.

Changes in v2:
- None

Cc: Jordan Crouse <[email protected]>
Reviewed-by: Jordan Crouse <[email protected]>
Signed-off-by: Sean Paul <[email protected]>
Link: 
https://patchwork.freedesktop.org/patch/msgid/[email protected]
Signed-off-by: Sasha Levin <[email protected]>
---
 drivers/gpu/drm/msm/adreno/a6xx_gmu.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c 
b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c
index 38e2cfa9cec7..418bb08bbed7 100644
--- a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c
+++ b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c
@@ -504,8 +504,10 @@ static void a6xx_gmu_rpmh_init(struct a6xx_gmu *gmu)
        wmb();
 
 err:
-       devm_iounmap(gmu->dev, pdcptr);
-       devm_iounmap(gmu->dev, seqptr);
+       if (!IS_ERR_OR_NULL(pdcptr))
+               devm_iounmap(gmu->dev, pdcptr);
+       if (!IS_ERR_OR_NULL(seqptr))
+               devm_iounmap(gmu->dev, seqptr);
 }
 
 /*
-- 
2.20.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Reply via email to