drm/amdgpu: Fix resource leak on probe error path
authorjsg <jsg@openbsd.org>
Wed, 4 Aug 2021 11:32:44 +0000 (11:32 +0000)
committerjsg <jsg@openbsd.org>
Wed, 4 Aug 2021 11:32:44 +0000 (11:32 +0000)
From Jiri Kosina
fc2756cce06f9833ebabd309b5b5080ed5c56897 in linux 5.10.y/5.10.56
d47255d3f87338164762ac56df1f28d751e27246 in mainline linux

sys/dev/pci/drm/amd/amdgpu/amdgpu_device.c

index 22b2ba0..b4c8715 100644 (file)
@@ -3380,13 +3380,13 @@ int amdgpu_device_init(struct amdgpu_device *adev,
        r = amdgpu_device_get_job_timeout_settings(adev);
        if (r) {
                dev_err(adev->dev, "invalid lockup_timeout parameter syntax\n");
-               goto failed_unmap;
+               return r;
        }
 
        /* early init functions */
        r = amdgpu_device_ip_early_init(adev);
        if (r)
-               goto failed_unmap;
+               return r;
 
        /* doorbell bar mapping and doorbell index init*/
        amdgpu_device_doorbell_init(adev);
@@ -3619,12 +3619,6 @@ failed:
        if (boco)
                vga_switcheroo_fini_domain_pm_ops(adev->dev);
 
-failed_unmap:
-#ifdef __linux__
-       iounmap(adev->rmmio);
-       adev->rmmio = NULL;
-#endif
-
        return r;
 }