Skip to content

Conversation

etienne-lms
Copy link
Contributor

Add missing test of some HAL functions return value in stm32 ethernet drivers.

Correct mdio_stm32_read() and mdio_stm32_write() to return a valid errno instead of mixing HAL return values and errno return values.

Plus some minor coding style issues fixes.

{
__ASSERT_NO_MSG(heth != NULL);
ETH_MACFilterConfigTypeDef MACFilterConf;
HAL_StatusTypeDef hal_ret;
Copy link
Contributor

Choose a reason for hiding this comment

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

Might need __maybe_unused because value is never consumed w/o asserts enabled (let's see what CI has to say)

HAL_ETH_GetMACConfig(heth, &mac_config);
if (HAL_ETH_GetMACConfig(heth, &mac_config) != HAL_OK) {
LOG_ERR("HAL_ETH_GetMACConfig: failed: %d", hal_ret);
ASSERT_NO_MSG(0);
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
ASSERT_NO_MSG(0);
__ASSERT_NO_MSG(0);

?

Copy link
Contributor

Choose a reason for hiding this comment

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

Typo in commit message for drivers: ethernet: stm32: clean HAL_ETH_{Set|Get}DMAError() value test

retrun --> return

Copy link
Contributor

@mathieuchopstm mathieuchopstm Oct 9, 2025

Choose a reason for hiding this comment

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

and I guess test against 0 ==> against HAL_OK too nvm, it returns a u32

Add missing test of some HAL functions return value

Signed-off-by: Etienne Carriere <[email protected]>
Clean tests on HAL_ETH_SetDMAError() and HAL_ETH_GetDMAError() return
value to explicitly test against 0.

Signed-off-by: Etienne Carriere <[email protected]>
Add missing empty line between local variable definitions and
instructions in eth_stm32_set_mac_config().

Signed-off-by: Etienne Carriere <[email protected]>
Correct mdio_stm32_read() and mdio_stm32_write() to return a valid errno
instead of mixing HAL return values and errno return values.

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

sonarqubecloud bot commented Oct 9, 2025

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

Successfully merging this pull request may close these issues.

5 participants