Skip to content

Conversation

etienne-lms
Copy link
Contributor

Add missing test of some HAL functions return value in STM32 DCMI and DCMIPP drivers.

Clarify HAL return value is of type HAL_StatusTypeDef and not an int in STM32 DCMI and DCMIPP drivers.

Copy link

@avolmat-st avolmat-st left a comment

Choose a reason for hiding this comment

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

Thanks @etienne-lms. Few comments.

HAL_StatusTypeDef hal_ret;

HAL_DCMI_Suspend(hdcmi);
hal _ret = HAL_DCMI_Suspend(hdcmi);

Choose a reason for hiding this comment

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

Variable name to be corrected. Seems there is space between hal and _ret.

ret = HAL_DCMIPP_PIPE_DisableISPRawBayer2RGB(&dcmipp->hdcmipp,
DCMIPP_PIPE1);
if (ret != HAL_OK) {
hal_et = HAL_DCMIPP_PIPE_DisableISPRawBayer2RGB(&dcmipp->hdcmipp,

Choose a reason for hiding this comment

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

s/hal_et/hal_ret

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks

/* Stop the external ISP handling */
ret = stm32_dcmipp_isp_stop();
if (ret < 0) {
if (ret != 0) {

Choose a reason for hiding this comment

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

In the other place in the driver, we use ret < 0 (except for HAL return values) so is there a specific reason to use != 0 instead here ?

Copy link
Contributor

Choose a reason for hiding this comment

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

+1. We should stick to < 0 unless there's a good reason not to.

Copy link
Contributor Author

@etienne-lms etienne-lms Oct 9, 2025

Choose a reason for hiding this comment

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

Well, I changed this line for consistency with the one you also commented below.
(edited) actually a stupid idea of mine since the above sets ret only when STM32_DCMIPP_HAS_PIXEL_PIPES is enabled.
But I agree they can be consistent testing both against < 0.
I'll update.

goto out;
}
if (ret != HAL_OK) {
if (ret != 0) {

Choose a reason for hiding this comment

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

Here as well. ret < 0 ?

struct stm32_dcmipp_data *dcmipp = pipe->dcmipp;
const DCMIPP_ColorConversionConfTypeDef *cfg = NULL;
int ret;
HAL_StatusTypeDef ret;
Copy link
Contributor

Choose a reason for hiding this comment

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

Would it be sensible to always variables involving the hal be named hal_ret even when there is no ret?
Otherwise, code that is moved from a function or another quickly faces the same issue.

Thank you for this PR.

Copy link
Contributor Author

@etienne-lms etienne-lms Oct 9, 2025

Choose a reason for hiding this comment

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

I agree it would be more consistent and less error prone on future changes.
I did not want to be too much intrusive but as you raise the question I guess it's worth it.

I'll update accordingly.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Clarify HAL return value is of type HAL_StatusTypeDef and not an
int in STM32 DCMI and DCMIPP drivers. For consistency, rename
the variable holding HAL return value from ret to hal_ret.

Signed-off-by: Etienne Carriere <[email protected]>
Add missing test of some HAL functions return value.

Signed-off-by: Etienne Carriere <[email protected]>
Copy link

@etienne-lms
Copy link
Contributor Author

Review comments addressed.

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

Successfully merging this pull request may close these issues.

6 participants