Skip to content

Commit 1600776

Browse files
konradybciorobclark
authored andcommitted
drm/msm/adreno: Assign msm_gpu->pdev earlier to avoid nullptrs
There are some cases, such as the one uncovered by Commit 46d4efc ("drm/msm/a6xx: Avoid a nullptr dereference when speedbin setting fails") where msm_gpu_cleanup() : platform_set_drvdata(gpu->pdev, NULL); is called on gpu->pdev == NULL, as the GPU device has not been fully initialized yet. Turns out that there's more than just the aforementioned path that causes this to happen (e.g. the case when there's speedbin data in the catalog, but opp-supported-hw is missing in DT). Assigning msm_gpu->pdev earlier seems like the least painful solution to this, therefore do so. Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org> Patchwork: https://patchwork.freedesktop.org/patch/602742/ Signed-off-by: Rob Clark <robdclark@chromium.org>
1 parent e193669 commit 1600776

2 files changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/gpu/drm/msm/adreno/adreno_gpu.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1087,6 +1087,7 @@ int adreno_gpu_init(struct drm_device *drm, struct platform_device *pdev,
10871087
adreno_gpu->chip_id = config->chip_id;
10881088

10891089
gpu->allow_relocs = config->info->family < ADRENO_6XX_GEN1;
1090+
gpu->pdev = pdev;
10901091

10911092
/* Only handle the core clock when GMU is not in use (or is absent). */
10921093
if (adreno_has_gmu_wrapper(adreno_gpu) ||

drivers/gpu/drm/msm/msm_gpu.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -931,7 +931,6 @@ int msm_gpu_init(struct drm_device *drm, struct platform_device *pdev,
931931
if (IS_ERR(gpu->gpu_cx))
932932
gpu->gpu_cx = NULL;
933933

934-
gpu->pdev = pdev;
935934
platform_set_drvdata(pdev, &gpu->adreno_smmu);
936935

937936
msm_devfreq_init(gpu);

0 commit comments

Comments
 (0)