drm/i915/gvt: fix vgpu debugfs clean in remove
authorjsg <jsg@openbsd.org>
Fri, 13 Jan 2023 01:54:11 +0000 (01:54 +0000)
committerjsg <jsg@openbsd.org>
Fri, 13 Jan 2023 01:54:11 +0000 (01:54 +0000)
From Zhenyu Wang
44c0e07e3972e3f2609d69ad873d4f342f8a68ec in linux-6.1.y/6.1.5
704f3384f322b40ba24d958473edfb1c9750c8fd in mainline linux

sys/dev/pci/drm/i915/gvt/debugfs.c

index d7df27f..e08ed0e 100644 (file)
@@ -175,8 +175,13 @@ void intel_gvt_debugfs_add_vgpu(struct intel_vgpu *vgpu)
  */
 void intel_gvt_debugfs_remove_vgpu(struct intel_vgpu *vgpu)
 {
-       debugfs_remove_recursive(vgpu->debugfs);
-       vgpu->debugfs = NULL;
+       struct intel_gvt *gvt = vgpu->gvt;
+       struct drm_minor *minor = gvt->gt->i915->drm.primary;
+
+       if (minor->debugfs_root && gvt->debugfs_root) {
+               debugfs_remove_recursive(vgpu->debugfs);
+               vgpu->debugfs = NULL;
+       }
 }
 
 /**