arch/arm: Fix FlexCAN config initializers clobbering rx_pin instead of enable_high - #19721
Open
Javinator9889 wants to merge 3 commits into
Open
arch/arm: Fix FlexCAN config initializers clobbering rx_pin instead of enable_high#19721Javinator9889 wants to merge 3 commits into
Javinator9889 wants to merge 3 commits into
Conversation
Javinator9889
requested review from
davids5,
gustavonihei and
jerpelea
as code owners
August 6, 2026 14:52
The `rx_pin` configuration when `CONFIG_S32K1XX_FLEXCAN2` is defined is overwritten if `PIN_CAN2_ENABLE` is defined, breaking the flexcan config for S32K1 MCU. Additionally, the `.enable_high` configuration points to a non-defined constant/macro (looks like a legacy from the first driver definition). Based on regularly maintained drivers (such as s32k3), this was changed to `CAN2_ENABLE_OUT` Signed-off-by: Javier Alonso <javieralonso@geotab.com>
The `rx_pin` configuration when `CONFIG_KINETIS_FLEXCAN2` is defined is overwritten if `PIN_CAN2_ENABLE` is defined, breaking the flexcan config for Kinetis MCU. Additionally, the `.enable_high` configuration points to a non-defined constant/macro (looks like a legacy from the first driver definition). Based on regularly maintained drivers (such as s32k3), this was changed to `CAN2_ENABLE_OUT` Signed-off-by: Javier Alonso <javieralonso@geotab.com>
The `rx_pin` configuration when `CONFIG_S32K3XX_FLEXCAN2` is defined is overwritten if `PIN_CAN2_ENABLE` is defined, breaking the flexcan config for S32K3 MCU. Signed-off-by: Javier Alonso <javieralonso@geotab.com>
Javinator9889
force-pushed
the
bugfix/s32k1_fix_flexcan_config
branch
from
August 6, 2026 15:10
1d506e0 to
96c505e
Compare
Javinator9889
requested review from
btashton and
xiaoxiang781216
as code owners
August 6, 2026 15:10
rx_pin configuration on #ifdef PIN_CAN2_ENABLE else branch
xiaoxiang781216
approved these changes
Aug 6, 2026
|
Contributor
Author
|
Looks like there was a runner failure... And I cannot re-trigger the pipeline |
Contributor
Author
@xiaoxiang781216 do you mind re-running the pipeline? The jobs did fail because of an HTTP error and the remaining jobs got cancelled because of it |
Contributor
restarted. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
The FlexCAN per-controller config initializers in three ARM drivers contain a
copy-paste defect: inside the CAN2 (and, on S32K3XX, CAN3) blocks a second
.rx_pindesignator appears where.enable_highwas intended. C designatedinitializers let a later designator for the same member silently override an
earlier one, so
.rx_pin = PIN_CANx_RXis discarded and.enable_highisnever assigned at all, falling back to 0 from static zero-initialization.
Testing
Tested locally on a S32K1 device with a CAN interface connected to it. The changes done to the other boards were not physically validated (but the error would be the same as they share the pins definition)