drm/msm/a6xx: Avoid a nullptr dereference when speedbin setting fails
authorKonrad Dybcio <konrad.dybcio@linaro.org>
Fri, 12 Apr 2024 08:53:25 +0000 (10:53 +0200)
committerRob Clark <robdclark@chromium.org>
Sat, 4 May 2024 16:41:54 +0000 (09:41 -0700)
commit46d4efcccc688cbacdd70a238bedca510acaa8e4
tree58695e87c7ab7e89f4e80b3dc0018ba95fb8d1b6
parent328660262df89ab64031059909d763f7a8af9570
drm/msm/a6xx: Avoid a nullptr dereference when speedbin setting fails

Calling a6xx_destroy() before adreno_gpu_init() leads to a null pointer
dereference on:

msm_gpu_cleanup() : platform_set_drvdata(gpu->pdev, NULL);

as gpu->pdev is only assigned in:

a6xx_gpu_init()
|_ adreno_gpu_init
    |_ msm_gpu_init()

Instead of relying on handwavy null checks down the cleanup chain,
explicitly de-allocate the LLC data and free a6xx_gpu instead.

Fixes: 76efc2453d0e ("drm/msm/gpu: Fix crash during system suspend after unbind")
Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org>
Patchwork: https://patchwork.freedesktop.org/patch/588919/
Signed-off-by: Rob Clark <robdclark@chromium.org>
drivers/gpu/drm/msm/adreno/a6xx_gpu.c