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

Protential bug of MAX_ASSERT usage #1017

Closed
TerryWoo123 opened this issue May 14, 2024 · 1 comment
Closed

Protential bug of MAX_ASSERT usage #1017

TerryWoo123 opened this issue May 14, 2024 · 1 comment

Comments

@TerryWoo123
Copy link

I found this line in in tmr_me16.c, Maybe there are similar lines in other files, for other peripherals or for other parts.
MXC_ASSERT((tmr_id = MXC_TMR_GET_IDX(tmr)) >= 0)

if max_assert feature is enabled by MXC_ASSERT_ENABLE, there is no bug. if MXC_ASSERT_ENABLE is not enabled, bug would be occurred. No matter what value tmr is, tmr_id will not be assigned a value, default value 0 will be wrongly used for the resting initialization steps.

I found some examples code in Keil IDE that, MXC_ASSERT_ENABLE is not enabled. the code doesn't run well.
the right usage is also already exsiting in MSDK,as below:

 	tmr_id = MXC_TMR_GET_IDX(tmr);
        MXC_ASSERT(tmr_id >= 0);

please help to update all the risky lines.

@EricB-ADI
Copy link
Contributor

@TerryWoo123 Thanks I am adding this fix into #1020

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

No branches or pull requests

2 participants