Three consecutive mutex_unlock/goto-out blocks guard against deleting,
RPROC_CRASHED and RPROC_OFFLINE but differ only in their condition.
Collapse them into a single if with OR'd conditions.  No behaviour change.

Signed-off-by: Mukesh Ojha <[email protected]>
---
 drivers/remoteproc/remoteproc_core.c | 16 +++-------------
 1 file changed, 3 insertions(+), 13 deletions(-)

diff --git a/drivers/remoteproc/remoteproc_core.c 
b/drivers/remoteproc/remoteproc_core.c
index 9d36e2f06348..41c2d3ebd568 100644
--- a/drivers/remoteproc/remoteproc_core.c
+++ b/drivers/remoteproc/remoteproc_core.c
@@ -1888,19 +1888,9 @@ static void rproc_crash_handler_work(struct work_struct 
*work)
 
        mutex_lock(&rproc->lock);
 
-       if (READ_ONCE(rproc->deleting)) {
-               mutex_unlock(&rproc->lock);
-               goto out;
-       }
-
-       if (rproc->state == RPROC_CRASHED) {
-               /* handle only the first crash detected */
-               mutex_unlock(&rproc->lock);
-               goto out;
-       }
-
-       if (rproc->state == RPROC_OFFLINE) {
-               /* Don't recover if the remote processor was stopped */
+       if (READ_ONCE(rproc->deleting) ||
+           rproc->state == RPROC_CRASHED ||
+           rproc->state == RPROC_OFFLINE) {
                mutex_unlock(&rproc->lock);
                goto out;
        }
-- 
2.53.0


Reply via email to