-
Notifications
You must be signed in to change notification settings - Fork 3k
Nuvoton: netsocket correction of judgment errors #12839
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@sword-huang, thank you for your changes. |
@sword-huang Thanks for the fix. Please describe the fix in few words in description, helps introducing the pull request. I added there a text for now Although as I don't have the entire context, it would help as well to provide a reason why -1 should be in there instead 0 (I'll read the code above and check return types to find out but should be provided in the commit message itself). |
Wouldn't this be better than relying on wrapping around ?
Then the checks for delayCnt == 0 are correct. |
Yes! Your code is more readable. I have recommitted. |
CI restarted |
Test run: SUCCESSSummary: 6 of 6 test jobs passed |
@ARMmbed/team-nuvoton please review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess the main point was for the code to be able to trigger the delayCnt == 0
condition, so this change indeed accomplished its goal. I also understand that this is just a brute-force delay.
However this change actually causes one loop run less: the decrement operator comes first before the comparison, so before the changes the loop ended after 1999 decrements, now it ends after 2000 decrements. It would be good if @ARMmbed/team-nuvoton confirmed that this is also OK. If not - we could do a do-while instead of while-do.
But honestly - I don't think this single loop run makes any difference, so I just approve (ipcore is mentioned as reviewers) ;-)
@@ -78,7 +78,8 @@ static int reset_phy(void) | |||
mdio_write(CONFIG_PHY_ADDR, MII_BMCR, BMCR_RESET); | |||
|
|||
delayCnt = 2000; | |||
while(delayCnt-- > 0) { | |||
while(delayCnt > 0) { | |||
delayCnt--; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please align this (4 spaces to left as other code)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This loop is to avoid endless waiting as while PHY broken.
Thanks of your modification.
remove tabs
Previous commit was incorrect (github does not show tabs..)
Previous commit was wrong (github does not show tabs properly)
I pushed the change via github (there were tabs, was tricky on github), will start CI later today |
CI started |
Test run: SUCCESSSummary: 6 of 6 test jobs passed |
Description
Fixing reset_phy for Nuvoton - there are two checks that work with invalid values, should check for -1.
Impact of changes
Migration actions required
None
Pull request type
Test results
Reviewers