Re: [PATCH] sr: dwc2/gadget: remove unneccessary if

From: Minas Harutyunyan
Date: Sat Jun 06 2020 - 11:45:33 EST


Hi Pavel,

On 6/6/2020 7:37 PM, Pavel Machek wrote:
> We don't really need if/else to set variable to 1/0.
>
> Signed-off-by: Pavel Machek (CIP) <pavel@xxxxxxx>
>
> diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c
> index 12b98b466287..f9f6fd470c81 100644
> --- a/drivers/usb/dwc2/gadget.c
> +++ b/drivers/usb/dwc2/gadget.c
> @@ -1761,10 +1761,7 @@ static int dwc2_hsotg_process_req_feature(struct dwc2_hsotg *hsotg,
> case USB_RECIP_DEVICE:
> switch (wValue) {
> case USB_DEVICE_REMOTE_WAKEUP:
> - if (set)
> - hsotg->remote_wakeup_allowed = 1;
> - else
> - hsotg->remote_wakeup_allowed = 0;
> + hsotg->remote_wakeup_allowed = set;
> break;
>
> case USB_DEVICE_TEST_MODE:
>

It's good catch, but 'set' declared as 'bool' while
'remote_wakeup_allowed' is 'unsigned int'. Maybe update 'set' type to same.

Thanks,
Minas