This patchset tries to fix several memory leakages/invalid memory accesses on error handling path during GPU driver loading/unloading. They applies to: https://gitlab.freedesktop.org/agd5f/linux.git amd-staging-drm-next v2: 1) rebased to https://gitlab.freedesktop.org/agd5f/linux.git branch amd-staging-drm-next. 2) removed the first patch, which is unnecessary. 3) add amdgpu_xcp_drm_dev_free() in patch 0003 to enhance amdxcp driver to better support device remove and error handling. 4) reworked patch 0005 to fix it in amdgpu instead of drm core. Jiang Liu (6): amdgpu: fix invalid memory access in kfd_cleanup_nodes() amdgpu: clear adev->in_suspend flag when fails to suspend drm/amdxcp: introduce new API amdgpu_xcp_drm_dev_free() amdgpu: fix use after free bug related to amdgpu_driver_release_kms() amdgpu: fix invalid memory access in amdgpu_fence_driver_sw_fini() amdgpu: get rid of false warnings caused by amdgpu_irq_put() drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 14 +++-- drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c | 13 +++- drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 4 +- drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_xcp.c | 11 +++- drivers/gpu/drm/amd/amdgpu/amdgpu_xcp.h | 1 + drivers/gpu/drm/amd/amdkfd/kfd_device.c | 9 +-- drivers/gpu/drm/amd/amdxcp/amdgpu_xcp_drv.c | 70 +++++++++++++++++---- drivers/gpu/drm/amd/amdxcp/amdgpu_xcp_drv.h | 1 + 9 files changed, 99 insertions(+), 25 deletions(-) -- 2.43.5