The patch below does not apply to the 6.1-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <stable@xxxxxxxxxxxxxxx>. To reproduce the conflict and resubmit, you may use the following commands: git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.1.y git checkout FETCH_HEAD git cherry-pick -x bc8f6d42b1334f486980d57c8d12f3128d30c2e3 # <resolve conflicts, build, test, etc.> git commit -s git send-email --to '<stable@xxxxxxxxxxxxxxx>' --in-reply-to '2024012747-stimuli-imprudent-3db0@gregkh' --subject-prefix 'PATCH 6.1.y' HEAD^.. Possible dependencies: bc8f6d42b133 ("drm/amdgpu: Fix null pointer dereference") 9a5095e785c3 ("drm/amdgpu: add amdgpu_reg_state.h") c8031019dc95 ("drm/amdgpu: Implement a new 64bit sequence memory driver") 2c1c7ba457d4 ("drm/amdgpu: support partition drm devices") 4bdca2057933 ("drm/amdgpu: Add utility functions for xcp") 75d1692393cb ("drm/amdgpu: Add initial version of XCP routines") ea2d2f8ececd ("drm/amdgpu: detect current GPU memory partition mode") 3d2ea552b229 ("drm/amdgpu: implement smuio v13_0_3 callbacks") 2fa480d36eb3 ("drm/amdgpu: add helpers to access registers on different AIDs") 1dfcdc30270a ("drm/amdgpu: switch to aqua_vanjaram_doorbell_index_init") cab7d478da11 ("drm/amdgpu: Add IP instance map for aqua vanjaram") 6df442a03d1a ("drm/amdgpu: add new doorbell assignment table for aqua_vanjaram") 8078f1c610fd ("drm/amdgpu: Change num_xcd to xcc_mask") 36be0181eab5 ("drm/amdgpu: program GRBM_MCM_ADDR for non-AID0 GRBM") 5de6bd6a13f1 ("drm/amdgpu: set mmhub bitmask for multiple AIDs") ed42f2cc3b56 ("drm/amdgpu: correct the vmhub reference for each XCD in gfxhub init") 74c5b85da754 ("drm/amdkfd: Add spatial partitioning support in KFD") 8dc1db3172ae ("drm/amdkfd: Introduce kfd_node struct (v5)") e6a02e2cc7fe ("drm/amdgpu: Add some XCC programming") bfb44eacb0e2 ("drm/amdkfd: Set F8_MODE for gc_v9_4_3") thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From bc8f6d42b1334f486980d57c8d12f3128d30c2e3 Mon Sep 17 00:00:00 2001 From: Hawking Zhang <Hawking.Zhang@xxxxxxx> Date: Mon, 22 Jan 2024 17:38:23 +0800 Subject: [PATCH] drm/amdgpu: Fix null pointer dereference amdgpu_reg_state_sysfs_fini could be invoked at the time when asic_func is even not initialized, i.e., amdgpu_discovery_init fails for some reason. Signed-off-by: Hawking Zhang <Hawking.Zhang@xxxxxxx> Reviewed-by: Lijo Lazar <lijo.lazar@xxxxxxx> Signed-off-by: Alex Deucher <alexander.deucher@xxxxxxx> Cc: stable@xxxxxxxxxxxxxxx diff --git a/drivers/gpu/drm/amd/include/amdgpu_reg_state.h b/drivers/gpu/drm/amd/include/amdgpu_reg_state.h index be519c8edf49..335980e2afbf 100644 --- a/drivers/gpu/drm/amd/include/amdgpu_reg_state.h +++ b/drivers/gpu/drm/amd/include/amdgpu_reg_state.h @@ -138,7 +138,7 @@ static inline size_t amdgpu_reginst_size(uint16_t num_inst, size_t inst_size, } #define amdgpu_asic_get_reg_state_supported(adev) \ - ((adev)->asic_funcs->get_reg_state ? 1 : 0) + (((adev)->asic_funcs && (adev)->asic_funcs->get_reg_state) ? 1 : 0) #define amdgpu_asic_get_reg_state(adev, state, buf, size) \ ((adev)->asic_funcs->get_reg_state ? \