Commit fecabfd9 authored by Jordan Crouse's avatar Jordan Crouse Committed by Rob Clark

drm/msm/dpu: Avoid a null de-ref while recovering from kms init fail

In the failure path for dpu_kms_init() it is possible to get to the MMU
destroy function with uninitialized MMU structs. Check for NULL and skip
if needed.
Signed-off-by: default avatarJordan Crouse <jcrouse@codeaurora.org>
Reviewed-by: default avatarKristian H. Kristensen <hoegsberg@google.com>
Signed-off-by: default avatarRob Clark <robdclark@chromium.org>
parent 36415615
...@@ -56,7 +56,7 @@ static const char * const iommu_ports[] = { ...@@ -56,7 +56,7 @@ static const char * const iommu_ports[] = {
#define DPU_DEBUGFS_HWMASKNAME "hw_log_mask" #define DPU_DEBUGFS_HWMASKNAME "hw_log_mask"
static int dpu_kms_hw_init(struct msm_kms *kms); static int dpu_kms_hw_init(struct msm_kms *kms);
static int _dpu_kms_mmu_destroy(struct dpu_kms *dpu_kms); static void _dpu_kms_mmu_destroy(struct dpu_kms *dpu_kms);
static unsigned long dpu_iomap_size(struct platform_device *pdev, static unsigned long dpu_iomap_size(struct platform_device *pdev,
const char *name) const char *name)
...@@ -713,17 +713,20 @@ static const struct msm_kms_funcs kms_funcs = { ...@@ -713,17 +713,20 @@ static const struct msm_kms_funcs kms_funcs = {
#endif #endif
}; };
static int _dpu_kms_mmu_destroy(struct dpu_kms *dpu_kms) static void _dpu_kms_mmu_destroy(struct dpu_kms *dpu_kms)
{ {
struct msm_mmu *mmu; struct msm_mmu *mmu;
if (!dpu_kms->base.aspace)
return;
mmu = dpu_kms->base.aspace->mmu; mmu = dpu_kms->base.aspace->mmu;
mmu->funcs->detach(mmu, (const char **)iommu_ports, mmu->funcs->detach(mmu, (const char **)iommu_ports,
ARRAY_SIZE(iommu_ports)); ARRAY_SIZE(iommu_ports));
msm_gem_address_space_put(dpu_kms->base.aspace); msm_gem_address_space_put(dpu_kms->base.aspace);
return 0; dpu_kms->base.aspace = NULL;
} }
static int _dpu_kms_mmu_init(struct dpu_kms *dpu_kms) static int _dpu_kms_mmu_init(struct dpu_kms *dpu_kms)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment