> -----Original Message-----
> From: Stefan Agner [mailto:ste...@agner.ch]
> Sent: Monday, February 12, 2018 7:15 AM
> To: Leo Li <leoyang...@nxp.com>; ba...@kernel.org
> Cc: gre...@linuxfoundation.org; linux-usb@vger.kernel.org; Stefan Agner
> <ste...@agner.ch>
> Subject: [PATCH] usb: gadget: fsl_udc_core: fix ep valid checks
> 
> Clang reports the following warning:
>   drivers/usb/gadget/udc/fsl_udc_core.c:1312:10: warning: address of array
>   'ep->name' will always evaluate to 'true' [-Wpointer-bool-conversion]
>         if (ep->name)
>         ~~  ~~~~^~~~
> 
> It seems that the authors intention was to check if the ep has been
> configured through struct_ep_setup. Check whether struct usb_ep name
> pointer has been set instead.
> 
> Signed-off-by: Stefan Agner <ste...@agner.ch>

Acked-by: Li Yang <leoyang...@nxp.com>

> ---
>  drivers/usb/gadget/udc/fsl_udc_core.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/gadget/udc/fsl_udc_core.c
> b/drivers/usb/gadget/udc/fsl_udc_core.c
> index e5b4ee96c4bf..56b517a38865 100644
> --- a/drivers/usb/gadget/udc/fsl_udc_core.c
> +++ b/drivers/usb/gadget/udc/fsl_udc_core.c
> @@ -1305,7 +1305,7 @@ static void udc_reset_ep_queue(struct fsl_udc
> *udc, u8 pipe)  {
>       struct fsl_ep *ep = get_ep_by_pipe(udc, pipe);
> 
> -     if (ep->name)
> +     if (ep->ep.name)
>               nuke(ep, -ESHUTDOWN);
>  }
> 
> @@ -1693,7 +1693,7 @@ static void dtd_complete_irq(struct fsl_udc *udc)
>               curr_ep = get_ep_by_pipe(udc, i);
> 
>               /* If the ep is configured */
> -             if (curr_ep->name == NULL) {
> +             if (!curr_ep->ep.name) {
>                       WARNING("Invalid EP?");
>                       continue;
>               }
> --
> 2.16.1

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to