-
Notifications
You must be signed in to change notification settings - Fork 3k
Fixed issue with PWM not being freed when the object is destroyed #10074
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
@morser499, thank you for your changes. |
@@ -68,6 +68,7 @@ class PwmOut { | |||
~PwmOut() | |||
{ | |||
core_util_critical_section_enter(); | |||
pwmout_free(&_pwm); |
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.
@ARMmbed/mbed-os-hal what was the reason not having this earlier ? I recall some discussions in some other drivers around definition of _free and implications for the rest of targets with change like this one.
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 thought it was because not all the targets had this function. If this is the case then CI should catch any problems.
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.
That is it !
We do not have 100 percent coverage in CI, I am thinking to be on safer side to have this on 5.13 rather - to keep this on master for some time.
CI started |
Test run: SUCCESSSummary: 13 of 13 test jobs passed |
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.
One small change request
* destructor. The pwmout_init handles multiple calls of constructor. | ||
*/ | ||
#if DEVICE_SLEEP && DEVICE_LPTICKER | ||
if (!Cy_SysPm_UnregisterCallback(&obj->pm_callback_handler)) |
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.
Can you fix the style {
on the same line (entire file is consistent)
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.
Done
8aaf145
to
51a4713
Compare
CI started |
Test run: SUCCESSSummary: 13 of 13 test jobs passed |
…-free Fixed issue with PWM not being freed when the object is destroyed
Description
Fixed issue with PWM not being freed when the object is destroyed. This caused the PWM to continue running after the destructor was called and it could cause a crash if another PWM was initialized.
Pull request type