drm/nouveau/device: call nvkm_device_fini if nvkm_device_init fails
authorAlexandre Courbot <acourbot@nvidia.com>
Mon, 25 Jan 2016 09:44:23 +0000 (18:44 +0900)
committerBen Skeggs <bskeggs@redhat.com>
Mon, 14 Mar 2016 00:11:06 +0000 (10:11 +1000)
nvkm_device_fini is never called if a failure occurs in
nvkm_device_init, even when unloading the module. This can lead to a
resources leak (one example is the Tegra interrupt which would never be
freed in that case). Fix this by calling nvkm_device_fini in
nvkm_device_init's failure path.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drivers/gpu/drm/nouveau/nvkm/engine/device/base.c

index b1ba1c7..8ef0ae8 100644 (file)
@@ -2261,6 +2261,8 @@ fail_subdev:
        } while (--i >= 0);
 
 fail:
+       nvkm_device_fini(device, false);
+
        nvdev_error(device, "init failed with %d\n", ret);
        return ret;
 }