From: Hayes Wang Date: Mon, 25 May 2020 03:11:18 +0000 Subject: [PATCH u-boot 1/2] eth/r8152: fix assigning the wrong endpoint In-Reply-To: <4b5c0971-9267-2209-7e4e-caf6b0325c3f@denx.de> References: <1394712342-15778-369-Taiwan-albertk@realtek.com> <1394712342-15778-370-Taiwan-albertk@realtek.com> <4b5c0971-9267-2209-7e4e-caf6b0325c3f@denx.de> Message-ID: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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