Skip to content

video: addition of __ASSERT to ensure proper arguments in api functions #90415

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

avolmat-st
Copy link
Collaborator

Over the video api function, some functions perform some pointer validation, via if statements or via __ASSERT while some other don't.
Some drivers also performs some pointers validity check (mostly on fmt pointers) while other don't.

In order to try to have something similar for all and avoid drivers having to think about wherher pointer checking is necessary or not, perform those checks within all API functions. Within api ops, drivers can now consider that all pointers are valid.

Alain Volmat added 2 commits May 23, 2025 22:17
Protect video API functions via __ASSERT call to ensure that
required pointers are valid when entering functions.

Signed-off-by: Alain Volmat <alain.volmat@foss.st.com>
Now that video api functions have __ASSERT calls, drivers
do not need to check the entry point functions pointers.

Signed-off-by: Alain Volmat <alain.volmat@foss.st.com>
Copy link

Copy link
Collaborator

@ngphibang ngphibang left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks !

BTW, I am not sure between __ASSERT and return -EINVAL, which one is more appropriate ? Returning error codes can let the program continue but require the caller to check the return value, ASSERT is simpler (I am up for ASSERT) ...

@avolmat-st
Copy link
Collaborator Author

LGTM. Thanks !

BTW, I am not sure between __ASSERT and return -EINVAL, which one is more appropriate ? Returning error codes can let the program continue but require the caller to check the return value, ASSERT is simpler (I am up for ASSERT) ...

I am been wondering myself as well. Here I think all parameters checked with ASSERT are never expected to have such value, meaning that there is for sure an issue in the application or caller, thus it seemed to be that anyway it doesn't make sense to let the program proceed, hence using ASSERT.

@josuah josuah assigned josuah and unassigned mmahadevan108 and dleach02 May 24, 2025
@josuah
Copy link
Collaborator

josuah commented May 24, 2025

switching the automated assignee to a video collaborator to reduce notification spam

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Video Video subsystem platform: ESP32 Espressif ESP32 platform: NXP Drivers NXP Semiconductors, drivers platform: STM32 ST Micro STM32
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants