[PATCH AUTOSEL 5.1 013/141] drm/msm/a6xx: Check for ERR or NULL before iounmap
From: Sasha Levin
Date: Fri Jul 19 2019 - 00:33:40 EST
From: Sean Paul <seanpaul@xxxxxxxxxxxx>
[ Upstream commit 5ca4a094ba7e1369363dcbcbde8baf06ddcdc2d1 ]
pdcptr and seqptr aren't necessarily valid, check them before trying to
unmap them.
Changes in v2:
- None
Cc: Jordan Crouse <jcrouse@xxxxxxxxxxxxxx>
Reviewed-by: Jordan Crouse <jcrouse@xxxxxxxxxxxxxx>
Signed-off-by: Sean Paul <seanpaul@xxxxxxxxxxxx>
Link: https://patchwork.freedesktop.org/patch/msgid/20190523171653.138678-3-sean@xxxxxxxxxx
Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>
---
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 d1662a75c7ec..9e4629c2e094 100644
--- a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c
+++ b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c
@@ -489,8 +489,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