* usb: gadget: fsl_udc_core: fix ep valid checks
@ 2018-02-11 23:14 Stefan Agner
0 siblings, 0 replies; 2+ messages in thread
From: Stefan Agner @ 2018-02-11 23:14 UTC (permalink / raw)
To: leoyang.li, balbi; +Cc: gregkh, linux-usb, Stefan Agner
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 <stefan@agner.ch>
---
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;
}
^ permalink raw reply related [flat|nested] 2+ messages in thread
* usb: gadget: fsl_udc_core: fix ep valid checks
@ 2018-03-01 4:44 Li Yang
0 siblings, 0 replies; 2+ messages in thread
From: Li Yang @ 2018-03-01 4:44 UTC (permalink / raw)
To: Stefan Agner, balbi; +Cc: gregkh, linux-usb
> -----Original Message-----
> From: Stefan Agner [mailto:stefan@agner.ch]
> Sent: Monday, February 12, 2018 7:15 AM
> To: Leo Li <leoyang.li@nxp.com>; balbi@kernel.org
> Cc: gregkh@linuxfoundation.org; linux-usb@vger.kernel.org; Stefan Agner
> <stefan@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 <stefan@agner.ch>
Acked-by: Li Yang <leoyang.li@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 majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-03-01 4:44 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-11 23:14 usb: gadget: fsl_udc_core: fix ep valid checks Stefan Agner
2018-03-01 4:44 Li Yang
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.