Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/amdgpu: fix NULL pointer dereference for Renoir

Commit c1cf79ca5ced46 ("drm/amdgpu: use IP discovery table for renoir")
introduced a NULL pointer dereference when booting with
amdgpu.discovery=0, because it removed the call of vega10_reg_base_init()
for that case.

Fix this by calling that funcion if amdgpu_discovery == 0 in addition to
the case that amdgpu_discovery_reg_base_init() failed.

Fixes: c1cf79ca5ced46 ("drm/amdgpu: use IP discovery table for renoir")
Signed-off-by: Dirk Gouders <dirk@gouders.net>
Cc: Hawking Zhang <Hawking.Zhang@amd.com>
Cc: Evan Quan <evan.quan@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Dirk Gouders and committed by
Alex Deucher
33eade2c d10285a2

+5 -5
+5 -5
drivers/gpu/drm/amd/amdgpu/soc15.c
··· 694 694 * it doesn't support SRIOV. */ 695 695 if (amdgpu_discovery) { 696 696 r = amdgpu_discovery_reg_base_init(adev); 697 - if (r) { 698 - DRM_WARN("failed to init reg base from ip discovery table, " 699 - "fallback to legacy init method\n"); 700 - vega10_reg_base_init(adev); 701 - } 697 + if (r == 0) 698 + break; 699 + DRM_WARN("failed to init reg base from ip discovery table, " 700 + "fallback to legacy init method\n"); 702 701 } 702 + vega10_reg_base_init(adev); 703 703 break; 704 704 case CHIP_VEGA20: 705 705 vega20_reg_base_init(adev);