On Tue, Aug 27, 2019 at 03:08:36PM +0200, Marek Vasut wrote: > On 8/27/19 3:02 PM, Niv Shetrit wrote: > > Signed-off-by: Niv Shetrit <niv.shet...@altair-semi.com> > > --- > > drivers/usb/gadget/core.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/drivers/usb/gadget/core.c b/drivers/usb/gadget/core.c > > index ffaf161fb7..ae7387ee0a 100644 > > --- a/drivers/usb/gadget/core.c > > +++ b/drivers/usb/gadget/core.c > > @@ -307,7 +307,7 @@ struct usb_endpoint_descriptor > > *usbd_device_endpoint_descriptor (struct usb_devi > > struct usb_endpoint_descriptor *endpoint_descriptor; > > int i; > > > > - for (i = 0; !(endpoint_descriptor = > > usbd_device_endpoint_descriptor_index (device, port, configuration, > > interface, alternate, i)); i++) { > > + for (i = 0; endpoint_descriptor = usbd_device_endpoint_descriptor_index > > (device, port, configuration, interface, alternate, i); i++) { > > if (endpoint_descriptor->bEndpointAddress == endpoint) { > > return endpoint_descriptor; > > } > > > > This changes the behavior of the code. Why is this needed ? The patch > needs detailed explanation of and rationale behind the change.
To start with, please put the coverity message you're addressing in the commit itself, not the introductory patch. Also please use Reported-by: Coverity (CID: xxx) in the commit itself. That said, not all issues coverity finds are strictly a problem and may be intentional or false positive. Coverity is complaining about how we're testing things here, but this rewrite doesn't have the same behavior. This type of issue is also a "code isn't as clear as it could be" thing because yes, it's uncommon to write the loop as it is here, but it's correct. Thanks! -- Tom
signature.asc
Description: PGP signature
_______________________________________________ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot