From a42ea3d61c65946f7ccb1fbba7361e31eb367026 Mon Sep 17 00:00:00 2001 From: Todd Poynor Date: Tue, 17 Jul 2018 13:56:52 -0700 Subject: [PATCH] staging: gasket: gasket_wait_with_reschedule simplify logic gasket_wait_with_reschedule() is a little more clear if we just return directly when the waited-for condition is hit. This also allows the following condition check to be removed and identation of the conditionally-executed code to be reduced. Reported-by: Dmitry Torokhov Signed-off-by: Zhongze Hu Signed-off-by: Todd Poynor Signed-off-by: Greg Kroah-Hartman --- drivers/staging/gasket/gasket_core.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/drivers/staging/gasket/gasket_core.c b/drivers/staging/gasket/gasket_core.c index 442543573f6e..5ae3d44f6166 100644 --- a/drivers/staging/gasket/gasket_core.c +++ b/drivers/staging/gasket/gasket_core.c @@ -2097,18 +2097,12 @@ int gasket_wait_with_reschedule( while (retries < max_retries) { tmp = gasket_dev_read_64(gasket_dev, bar, offset); if ((tmp & mask) == val) - break; + return 0; msleep(delay_ms); retries++; } - if (retries == max_retries) { - gasket_log_error( - gasket_dev, - "%s timeout: reg %llx timeout (%llu ms)", - __func__, - offset, max_retries * delay_ms); - return -ETIMEDOUT; - } - return 0; + gasket_log_error(gasket_dev, "%s timeout: reg %llx timeout (%llu ms)", + __func__, offset, max_retries * delay_ms); + return -ETIMEDOUT; } EXPORT_SYMBOL(gasket_wait_with_reschedule); -- 2.30.2