Skip to content
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

Redundant "if" statement in Master Async handler of I2C driver #753

Closed
muxx999 opened this issue Oct 4, 2023 · 1 comment · Fixed by #781
Closed

Redundant "if" statement in Master Async handler of I2C driver #753

muxx999 opened this issue Oct 4, 2023 · 1 comment · Fixed by #781
Assignees

Comments

@muxx999
Copy link

muxx999 commented Oct 4, 2023

Location: msdk/Libraries/PeriphDrivers/Source/I2C/i2c_reva.c
Function MXC_I2C_RevA_MasterAsyncHandler(int i2cNum)
Lines 1442-1447 /* Call the callback */

The issue does no harm just contains an if/else statement a part of which is never called.
The statement can be replaced by single line:
MXC_I2C_RevA_AsyncCallback(i2c, E_NO_ERROR);
because 1) the intfl0 flags get cleared in line 1432, so the 'if' expression is always 0,
2) the case of errors present ( E_COMM_ERR ) is taken care of at block 1355-1368 /* Check for errors */.

@Jake-Carter Jake-Carter added the documentation Improvements or additions to documentation label Oct 10, 2023
@Jake-Carter Jake-Carter self-assigned this Oct 10, 2023
@Jake-Carter Jake-Carter added bug Something isn't working and removed documentation Improvements or additions to documentation bug Something isn't working labels Oct 10, 2023
@Jake-Carter
Copy link
Contributor

Thanks @muxx999, agreed we can remove the extra conditional

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants