summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/common/nvlink.c
diff options
context:
space:
mode:
authorSeema Khowala <seemaj@nvidia.com>2018-07-16 15:29:27 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2018-07-19 00:23:58 -0400
commit74e1a11d840b3d7411b380c2e4e4c99126ea32a5 (patch)
tree401ff87662f109d468e3d8d16c1d7bf12c1ceb13 /drivers/gpu/nvgpu/common/nvlink.c
parent96d53bff8598a44fcec3f2492c8ec630d71d5dd0 (diff)
gpu: nvgpu: nvlink: remove device only if it is present
nvlink can be disabled via DT. Check if nvlink device is present before calling nvlink specific functions to remove the device during shutdown. Change-Id: I33480425e2991c008f02dac989b56f21a54aa902 Signed-off-by: Seema Khowala <seemaj@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1779381 Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com> GVS: Gerrit_Virtual_Submit Reviewed-by: Vijayakumar Subbu <vsubbu@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/common/nvlink.c')
-rw-r--r--drivers/gpu/nvgpu/common/nvlink.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/common/nvlink.c b/drivers/gpu/nvgpu/common/nvlink.c
index 1a6ee853..6bfc154c 100644
--- a/drivers/gpu/nvgpu/common/nvlink.c
+++ b/drivers/gpu/nvgpu/common/nvlink.c
@@ -510,7 +510,12 @@ int nvgpu_nvlink_remove(struct gk20a *g)
510 struct nvlink_device *ndev; 510 struct nvlink_device *ndev;
511 int err; 511 int err;
512 512
513 if (!nvgpu_is_enabled(g, NVGPU_SUPPORT_NVLINK))
514 return -ENODEV;
515
513 ndev = g->nvlink.priv; 516 ndev = g->nvlink.priv;
517 if(!ndev)
518 return -ENODEV;
514 519
515 __nvgpu_set_enabled(g, NVGPU_SUPPORT_NVLINK, false); 520 __nvgpu_set_enabled(g, NVGPU_SUPPORT_NVLINK, false);
516 521