From 0166ffdc89bf4d5f50852eb4bc86bbd18cffd4f9 Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Tue, 29 Mar 2022 12:37:54 +0200 Subject: [PATCH] staging: r8188eu: refactor rtw_inc_and_chk_continual_urb_error() Refactor rtw_inc_and_chk_continual_urb_error(). Return directly instead of using a return variable and initialize the variable 'value' at declaration. This shortens the code and improves readability. Signed-off-by: Michael Straube Link: https://lore.kernel.org/r/20220329103756.6740-3-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/include/usb_ops.h | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/staging/r8188eu/include/usb_ops.h b/drivers/staging/r8188eu/include/usb_ops.h index 3416c8ba..cfcf6f8 100644 --- a/drivers/staging/r8188eu/include/usb_ops.h +++ b/drivers/staging/r8188eu/include/usb_ops.h @@ -27,13 +27,12 @@ */ static inline int rtw_inc_and_chk_continual_urb_error(struct dvobj_priv *dvobj) { - int ret = false; - int value; - value = atomic_inc_return(&dvobj->continual_urb_error); + int value = atomic_inc_return(&dvobj->continual_urb_error); + if (value > MAX_CONTINUAL_URB_ERR) - ret = true; + return true; - return ret; + return false; } /* -- 2.7.4