Skip to content

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

Merged
merged 1 commit into from
Mar 27, 2019

Conversation

morser499
Copy link

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

[x] Fix
[ ] Refactor
[ ] Target update
[ ] Functionality change
[ ] Docs update
[ ] Test update
[ ] Breaking change

@ciarmcom
Copy link
Member

@morser499, thank you for your changes.
@ARMmbed/mbed-os-core @ARMmbed/mbed-os-maintainers please review.

@ciarmcom ciarmcom requested review from a team March 13, 2019 02:00
@0xc0170 0xc0170 requested a review from a team March 13, 2019 09:30
@@ -68,6 +68,7 @@ class PwmOut {
~PwmOut()
{
core_util_critical_section_enter();
pwmout_free(&_pwm);
Copy link
Contributor

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.

Copy link
Contributor

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.

Copy link
Contributor

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.

@cmonr
Copy link
Contributor

cmonr commented Mar 18, 2019

CI started

@mbed-ci
Copy link

mbed-ci commented Mar 19, 2019

Test run: SUCCESS

Summary: 13 of 13 test jobs passed
Build number : 1
Build artifacts

Copy link
Contributor

@0xc0170 0xc0170 left a 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))
Copy link
Contributor

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)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@morser499 morser499 force-pushed the cy-mbed-os-5.12.0-pwm-free branch from 8aaf145 to 51a4713 Compare March 21, 2019 14:49
@cmonr cmonr requested a review from 0xc0170 March 25, 2019 19:33
@cmonr cmonr dismissed 0xc0170’s stale review March 26, 2019 01:44

Change addressed.

@cmonr
Copy link
Contributor

cmonr commented Mar 26, 2019

CI started

@mbed-ci
Copy link

mbed-ci commented Mar 26, 2019

Test run: SUCCESS

Summary: 13 of 13 test jobs passed
Build number : 2
Build artifacts

cmonr pushed a commit to cmonr/mbed-os that referenced this pull request Mar 26, 2019
…-free

Fixed issue with PWM not being freed when the object is destroyed
@cmonr cmonr merged commit 0395150 into ARMmbed:master Mar 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants