[PATCH u-boot 1/2] eth/r8152: fix assigning the wrong endpoint

Hayes Wang hayeswang at realtek.com
Mon May 25 05:11:18 CEST 2020


Marek Vasut [mailto:marex at denx.de]
> Sent: Friday, May 22, 2020 9:22 PM
[...]
> > -			if ((ep_addr & USB_DIR_IN) && !ep_in_found) {
> > -				ss->ep_in = ep_addr &
> > -					USB_ENDPOINT_NUMBER_MASK;
> > -				ep_in_found = 1;
> > +
> > +			if (ep_addr & USB_DIR_IN) {
> > +				if (!ep_in_found) {
> > +					ss->ep_in = ep_addr &
> > +						USB_ENDPOINT_NUMBER_MASK;
> > +					ep_in_found = 1;
> > +				}
> 
> So why don't you rework the code this way instead, to make it easier to
> understand:

Ok, I'll do it and resend this patch. Thanks.

> if ((ep_addr & USB_DIR_IN) && !ep_in_found) {
>  ... do in stuff ...
> }
> 
> if ((ep_addr & USB_DIR_OUT) && !ep_out_found) {
>  ... do out stuff ...
> }
> 
> Would that work ?

Yes.

Best Regards,
Hayes


More information about the U-Boot mailing list