Skip to content

drivers: flash: Clarify parameter validation order #90706

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

dleach02
Copy link
Member

@dleach02 dleach02 commented May 28, 2025

Add some clarity on expected parameter validation order to have
consistency between implementations.

Update NXP flash drivers to align with parameter validation order

Fixes #87021

Signed-off-by: David Leach david.leach@nxp.com

@dleach02 dleach02 requested a review from de-nordic May 28, 2025 02:36
@github-actions github-actions bot added area: Flash platform: NXP S32 NXP Semiconductors, S32 platform: NXP Drivers NXP Semiconductors, drivers labels May 28, 2025
@dleach02 dleach02 changed the title drivers: flash: Add documentation on read API drivers: flash: Clarify parameter validation order May 28, 2025
dleach02 added 2 commits May 28, 2025 11:15
Add some clarity on expected parameter validation order to have
consistency between implementations.

Signed-off-by: David Leach <david.leach@nxp.com>
Parameter checking of flash read API expects checking for len == 0
before checking dest buffer validation.

Fixes zephyrproject-rtos#87021

Signed-off-by: David Leach <david.leach@nxp.com>
return 0;
}

if (!buffer) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not compliant with Coding Guidelines, Zephyr rule 85 (https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_14_04.c), should be buffer == NULL.

Copy link
Collaborator

Choose a reason for hiding this comment

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

OK, now I see that the entire driver keeps that style, so the decision is on you.

Copy link
Collaborator

@de-nordic de-nordic left a comment

Choose a reason for hiding this comment

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

One Coding Guidelines comment, otherwise looks OK.
Thanks for providing read callback documentation.

Copy link

@dleach02
Copy link
Member Author

To avoid losing the +1 I'm going to follow up this PR with a new one that will just align to the coding guideline @de-nordic pointed out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Flash platform: NXP Drivers NXP Semiconductors, drivers platform: NXP S32 NXP Semiconductors, S32
Projects
None yet
Development

Successfully merging this pull request may close these issues.

drivers: flash: flash_mcux_flexspi_nor incorrectly handles border case
3 participants