Skip to content

Conversation

@Dilip-Raman
Copy link

Fix invalid pointer-to-integer cast and comparison warnings in ADXL362, ADXL367, and ADXL372 decoder drivers. The previous code used (uint8_t *)*fit for offset comparison, which triggered -Wint-to-pointer-cast warnings on recent compilers and could lead to undefined behavior.

This patch replaces unsafe casts with uintptr_t arithmetic and ensures type-safe offset calculations, preserving existing logic while eliminating all build warnings.

@github-actions
Copy link

Hello @Dilip-Raman, and thank you very much for your first pull request to the Zephyr project!
Our Continuous Integration pipeline will execute a series of checks on your Pull Request commit messages and code, and you are expected to address any failures by updating the PR. Please take a look at our commit message guidelines to find out how to format your commit messages, and at our contribution workflow to understand how to update your Pull Request. If you haven't already, please make sure to review the project's Contributor Expectations and update (by amending and force-pushing the commits) your pull request if necessary.
If you are stuck or need help please join us on Discord and ask your question there. Additionally, you can escalate the review when applicable. 😊

@pdgendt
Copy link
Contributor

pdgendt commented Nov 14, 2025

Please fix the compliance issue (DCO signed-off needs a full name). The other compliance issues are on main and not related to this PR.

Fix invalid pointer-to-integer cast and comparison warnings in
ADXL362, ADXL367, and ADXL372 decoder drivers. The previous code
used `(uint8_t *)*fit` for offset comparison, which triggered
`-Wint-to-pointer-cast` warnings on recent compilers and could
lead to undefined behavior.

This patch replaces unsafe casts with `uintptr_t` arithmetic and
ensures type-safe offset calculations, preserving existing logic
while eliminating all build warnings.

Signed-off-by: Dilip Raman <[email protected]>
@Dilip-Raman Dilip-Raman force-pushed the fix/adxl-build-warnings branch from 7a12829 to 82786ed Compare November 14, 2025 16:08
@sonarqubecloud
Copy link

@Dilip-Raman
Copy link
Author

Please fix the compliance issue (DCO signed-off needs a full name). The other compliance issues are on main and not related to this PR.

Please review it. I changed the (DCO signed-off needs a full name).

@pdgendt
Copy link
Contributor

pdgendt commented Nov 14, 2025

Please review it. I changed the (DCO signed-off needs a full name).

Compliance passes, make sure to mark it ready for review to pull in the maintainers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: Sensors Sensors platform: ADI Analog Devices, Inc.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Build warnings for adxl362_decoder.c/adxl367_decoder.c/adxl372_decoder.c

4 participants