From 7b3d5d6bf07e9d7633995ca7c4c1ab4090a139e7 Mon Sep 17 00:00:00 2001 From: Thomas Fleury Date: Wed, 26 Dec 2018 15:13:24 -0800 Subject: [PATCH] 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 Reviewed-on: https://git-master.nvidia.com/r/1982242 (cherry picked from commit 78c513790ac64605cea673c26e6d0d71c3d8db0a) Reviewed-on: https://git-master.nvidia.com/r/2215159 Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Tested-by: Peter Daifuku Reviewed-by: Satish Arora Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/include/nvgpu/linux/cond.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/nvgpu/include/nvgpu/linux/cond.h b/drivers/gpu/nvgpu/include/nvgpu/linux/cond.h index afe9c8c84..b53ada37d 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/linux/cond.h +++ b/drivers/gpu/nvgpu/include/nvgpu/linux/cond.h @@ -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 * under the terms and conditions of the GNU General Public License, @@ -73,7 +73,7 @@ struct nvgpu_cond { else if (_ret == -ERESTARTSYS) \ ret = -ERESTARTSYS; \ } else { \ - wait_event_interruptible((c)->wq, condition); \ + ret = wait_event_interruptible((c)->wq, condition); \ } \ ret; \ })