mirror of
git://nv-tegra.nvidia.com/linux-nv-oot.git
synced 2025-12-24 10:11:26 +03:00
platform: dce: Coverity Fix
Fix Coverity issue CID 10138164 Create new macro to avoid non-reachable code. Bug 3461002 Signed-off-by: Mahesh Kumar <mahkumar@nvidia.com> Change-Id: Ie5ff50678e30ae0ddd712ceda212f4b572ce624e Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2765168 Reviewed-by: svcacv <svcacv@nvidia.com> Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com> Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com> Reviewed-by: Arun Swain <arswain@nvidia.com> GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
committed by
Laxman Dewangan
parent
c032aa992e
commit
a42af2d0ad
@@ -279,8 +279,7 @@ int dce_client_ipc_wait(struct tegra_dce *d, u32 int_type)
|
||||
|
||||
retry_wait:
|
||||
DCE_COND_WAIT_INTERRUPTIBLE(&cl->recv_wait,
|
||||
atomic_read(&cl->complete) == 1,
|
||||
0);
|
||||
atomic_read(&cl->complete) == 1);
|
||||
if (atomic_read(&cl->complete) != 1)
|
||||
goto retry_wait;
|
||||
|
||||
|
||||
@@ -39,8 +39,7 @@ int dce_wait_interruptible(struct tegra_dce *d, u32 msg_id)
|
||||
atomic_set(&wait->complete, 0);
|
||||
|
||||
DCE_COND_WAIT_INTERRUPTIBLE(&wait->cond_wait,
|
||||
atomic_read(&wait->complete) == 1,
|
||||
0);
|
||||
atomic_read(&wait->complete) == 1);
|
||||
|
||||
if (atomic_read(&wait->complete) != 1)
|
||||
return -EINTR;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019-2020, NVIDIA CORPORATION. All rights reserved.
|
||||
* Copyright (c) 2019-2022, 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,
|
||||
@@ -27,6 +27,37 @@ struct dce_cond {
|
||||
*
|
||||
* @c - The condition variable to sleep on
|
||||
* @condition - The condition that needs to be true
|
||||
*
|
||||
* Wait for a condition to become true.
|
||||
*/
|
||||
#define DCE_COND_WAIT(c, condition) \
|
||||
({\
|
||||
int ret = 0; \
|
||||
wait_event((c)->wq, condition); \
|
||||
ret;\
|
||||
})
|
||||
|
||||
/**
|
||||
* DCE_COND_WAIT_INTERRUPTIBLE - Wait for a condition to be true
|
||||
*
|
||||
* @c - The condition variable to sleep on
|
||||
* @condition - The condition that needs to be true
|
||||
*
|
||||
* Wait for a condition to become true. Returns -ERESTARTSYS
|
||||
* on signal.
|
||||
*/
|
||||
#define DCE_COND_WAIT_INTERRUPTIBLE(c, condition) \
|
||||
({ \
|
||||
int ret = 0; \
|
||||
ret = wait_event_interruptible((c)->wq, condition); \
|
||||
ret; \
|
||||
})
|
||||
|
||||
/**
|
||||
* DCE_COND_WAIT_TIMEOUT - Wait for a condition to be true
|
||||
*
|
||||
* @c - The condition variable to sleep on
|
||||
* @condition - The condition that needs to be true
|
||||
* @timeout_ms - Timeout in milliseconds, or 0 for infinite wait.
|
||||
* This parameter must be a u32. Since this is a macro, this is
|
||||
* enforced by assigning a typecast NULL pointer to a u32 tmp
|
||||
@@ -36,7 +67,7 @@ struct dce_cond {
|
||||
* Wait for a condition to become true. Returns -ETIMEOUT if
|
||||
* the wait timed out with condition false.
|
||||
*/
|
||||
#define DCE_COND_WAIT(c, condition, timeout_ms) \
|
||||
#define DCE_COND_WAIT_TIMEOUT(c, condition, timeout_ms) \
|
||||
({\
|
||||
int ret = 0; \
|
||||
/* This is the assignment to enforce a u32 for timeout_ms */ \
|
||||
@@ -54,7 +85,7 @@ struct dce_cond {
|
||||
})
|
||||
|
||||
/**
|
||||
* DCE_COND_WAIT_INTERRUPTIBLE - Wait for a condition to be true
|
||||
* DCE_COND_WAIT_INTERRUPTIBLE_TIMEOUT - Wait for a condition to be true
|
||||
*
|
||||
* @c - The condition variable to sleep on
|
||||
* @condition - The condition that needs to be true
|
||||
@@ -68,7 +99,7 @@ struct dce_cond {
|
||||
* the wait timed out with condition false or -ERESTARTSYS on
|
||||
* signal.
|
||||
*/
|
||||
#define DCE_COND_WAIT_INTERRUPTIBLE(c, condition, timeout_ms) \
|
||||
#define DCE_COND_WAIT_INTERRUPTIBLE_TIMEOUT(c, condition, timeout_ms) \
|
||||
({ \
|
||||
int ret = 0; \
|
||||
/* This is the assignment to enforce a u32 for timeout_ms */ \
|
||||
|
||||
Reference in New Issue
Block a user