fix(Other): Fix Wrap_MXC_CAN_Init signature #1320
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Fixes a bug introduced by #1306, which added a Zephyr wrapper for
MXC_CAN_Init
, whose signature differs between the MAX32662 and MAX32690.The previous implementation declared
Wrap_MXC_CAN_Init
asvoid
and discarded the return value of the underlyingMXC_CAN_Init
calls. This is incompatible with the can_max32 driver which does error checking and expects anint
return value.While this is a "breaking" change, no code currently depends on this wrapper, because its signature is invalid and could not be properly used in the can_max32 driver.
How did this happen?
This is entirely my fault, as I was rushing to get some zephyr can_max32 changes in, on the last Friday before the winter holiday break. (I am now well aware of how stupid that is...)
While working on this wrapper, I used the following forks: trupples/msdk, trupples/hal_adi. I did catch this error and fixed it in hal_adi, but didn't push the same changes to msdk.
At that point, trupples/hal_adi had the correct implementation (int return), but trupples/msdk did not (void return).
I was able to build and test an application using the driver, because in zephyr I only referenced my hal_adi repo. In PR #1306 I claimed the wrapper is correct and tested, and the PR got accepted, but with the wrong code. The wrong code was then automatically copied to analogdevicesinc/hal_adi.
NB: should have listened to shouldideploy.today
Validation
A minimal example to test this on both MAX32662 and MAX32690 can be found at trupples/max32-can-validate. It unfortunately requires some fiddling around to get the WIP driver from innersource. Most importantly, the entire process is automated by
validate.sh
, which:west update
to more easily apply the changes)Usage:
I have successfully run this, and I am quite confident that I am not wasting your time with a second bad PR, but I'd like a sanity check.
Checklist Before Requesting Review