Re: [PATCH 3/3] staging: r8188eu: simplify rtw_inc_and_chk_continual_urb_error

From: Greg Kroah-Hartman
Date: Tue Apr 05 2022 - 17:55:07 EST


On Tue, Apr 05, 2022 at 06:12:40PM +0530, Vihas Makwana wrote:
> The if check and variable "value" is redundant. Drop it and simplify
> the funciton.
>
> Signed-off-by: Vihas Makwana <makvihas@xxxxxxxxx>
> ---
> drivers/staging/r8188eu/include/usb_ops.h | 7 +------
> 1 file changed, 1 insertion(+), 6 deletions(-)
>
> diff --git a/drivers/staging/r8188eu/include/usb_ops.h b/drivers/staging/r8188eu/include/usb_ops.h
> index ddc46cb44..c5982704c 100644
> --- a/drivers/staging/r8188eu/include/usb_ops.h
> +++ b/drivers/staging/r8188eu/include/usb_ops.h
> @@ -27,12 +27,7 @@
> */
> static inline bool rtw_inc_and_chk_continual_urb_error(struct dvobj_priv *dvobj)
> {
> - int value = atomic_inc_return(&dvobj->continual_urb_error);
> -
> - if (value > MAX_CONTINUAL_URB_ERR)
> - return true;
> -
> - return false;
> + return atomic_inc_return(&dvobj->continual_urb_error) > MAX_CONTINUAL_URB_ERR;
> }

Let's leave this as-is because it's a mess and should be fixed up
anyway. No need to count urb errors as atomic values, this is crazy.

thanks,

greg k-h