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

Typo in new timer code #18

Closed
dresco opened this issue Oct 12, 2024 · 4 comments
Closed

Typo in new timer code #18

dresco opened this issue Oct 12, 2024 · 4 comments

Comments

@dresco
Copy link
Contributor

dresco commented Oct 12, 2024

Just noticed this while merging latest changes into H7 driver..

STM32F7xx/Src/timers.c

Lines 313 to 317 in 8ccfaa0

#ifdef TIM7
case (uint32_t)TIM14:
__HAL_RCC_TIM14_CLK_ENABLE();
break;
#endif

@dresco
Copy link
Contributor Author

dresco commented Oct 12, 2024

Also, seeing a hardfault during the port claiming process when an aux out port is not pwm capable, execution gets to the return statement of pwm_is_available() with pwm still NULL;

return !timer_is_claimed(pwm->timer);

@dresco
Copy link
Contributor Author

dresco commented Oct 14, 2024

Hi Terje, just wanted to query that pwm.c fix (haven't tried it yet)..

return pwm && !timer_is_claimed(pwm->timer);

Won't pwm->timer get dereferenced anyway, even if pwm is null?

I was hitting the hardfault on some build configurations but not others, so my suspicion was that pwm->timer was pointing to an invalid memory address depending on compile options.

@terjeio
Copy link
Contributor

terjeio commented Oct 14, 2024

Won't pwm->timer get dereferenced anyway, even if pwm is null?

No, it should not.

@dresco
Copy link
Contributor Author

dresco commented Oct 14, 2024

No, it should not.

Cool, thanks! Never knew that was a defined behaviour...

@dresco dresco closed this as completed Oct 14, 2024
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