From 0b7fbc1ff457580cf8ae3f7a8a55f5ab36bfd8e7 Mon Sep 17 00:00:00 2001 From: Nitin Kumbhar Date: Wed, 4 Jul 2018 22:54:08 +0530 Subject: gpu: nvgpu: skip suspend if gpu already removed On nvgpu module unload, platform_driver_unregister() detaches driver from device (driver_detach()). As part of this, __device_release_driver() results a race between driver's .runtime_resume(), .remove() and .runtime_suspend(). As nvgpu's .remove() is handling all steps of cleaning up driver state and shutting down gpu, .runtime_suspend() shall have no work. So skip .runtime_suspend() is gk20a *g has already been processed. Bug 1987855 Change-Id: I024ac63d321689ea04c64b1ffc125da943d482f9 Signed-off-by: Nitin Kumbhar Reviewed-on: https://git-master.nvidia.com/r/1770803 Reviewed-by: svc-mobile-coverity GVS: Gerrit_Virtual_Submit Reviewed-by: Seshendra Gadagottu Reviewed-by: Terje Bergstrom Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/os/linux/module.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'drivers/gpu/nvgpu/os/linux/module.c') diff --git a/drivers/gpu/nvgpu/os/linux/module.c b/drivers/gpu/nvgpu/os/linux/module.c index 28ade90f..a59ac1f1 100644 --- a/drivers/gpu/nvgpu/os/linux/module.c +++ b/drivers/gpu/nvgpu/os/linux/module.c @@ -936,6 +936,9 @@ static int gk20a_pm_runtime_suspend(struct device *dev) int err = 0; struct gk20a *g = get_gk20a(dev); + if (!g) + return 0; + if (gk20a_gpu_is_virtual(dev)) err = vgpu_pm_prepare_poweroff(dev); else -- cgit v1.2.2