-
Notifications
You must be signed in to change notification settings - Fork 7.4k
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
base: main
Are you sure you want to change the base?
Conversation
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) { |
There was a problem hiding this comment.
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
.
There was a problem hiding this comment.
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.
There was a problem hiding this 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.
|
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. |
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