gpu: nvgpu: fix NVGPU_COND_WAIT_INTERRUPTIBLE

When called with timeout=0, NVGPU_COND_WAIT_INTERRUPTIBLE macro
ignores the return code from wait_event_interruptible. As a result
we do not detect when the call is interrupted, and the calling
process hangs.

Use wait_event_interruptible return code in case of infinite timeout.

Bug 200384829
Bug 200543218

Change-Id: I930f0d08c73a3b91ab20a6c8faaf633a3d7aee4d
Signed-off-by: Thomas Fleury <tfleury@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1982242
(cherry picked from commit 78c513790a)
Reviewed-on: https://git-master.nvidia.com/r/2215159
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Tested-by: Peter Daifuku <pdaifuku@nvidia.com>
Reviewed-by: Satish Arora <satisha@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Thomas Fleury
2018-12-26 15:13:24 -08:00
committed by mobile promotions
parent 99700222a5
commit 7b3d5d6bf0

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved. * Copyright (c) 2017-2019, NVIDIA CORPORATION. All rights reserved.
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License, * under the terms and conditions of the GNU General Public License,
@@ -73,7 +73,7 @@ struct nvgpu_cond {
else if (_ret == -ERESTARTSYS) \ else if (_ret == -ERESTARTSYS) \
ret = -ERESTARTSYS; \ ret = -ERESTARTSYS; \
} else { \ } else { \
wait_event_interruptible((c)->wq, condition); \ ret = wait_event_interruptible((c)->wq, condition); \
} \ } \
ret; \ ret; \
}) })