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>
This commit is contained in:
Seema Khowala
2018-07-16 12:29:27 -07:00
committed by mobile promotions
parent 96d53bff85
commit 74e1a11d84

View File

@@ -510,7 +510,12 @@ int nvgpu_nvlink_remove(struct gk20a *g)
struct nvlink_device *ndev;
int err;
if (!nvgpu_is_enabled(g, NVGPU_SUPPORT_NVLINK))
return -ENODEV;
ndev = g->nvlink.priv;
if(!ndev)
return -ENODEV;
__nvgpu_set_enabled(g, NVGPU_SUPPORT_NVLINK, false);