Skip to content
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

STM32 Ethernet driver build failure with CONFIG_ASSERT=1 #25427

Closed
bwasim opened this issue May 18, 2020 · 1 comment · Fixed by #25428
Closed

STM32 Ethernet driver build failure with CONFIG_ASSERT=1 #25427

bwasim opened this issue May 18, 2020 · 1 comment · Fixed by #25428
Assignees
Labels
bug The issue is a bug, or the PR is fixing a bug platform: STM32 ST Micro STM32 priority: high High impact/importance bug
Milestone

Comments

@bwasim
Copy link
Contributor

bwasim commented May 18, 2020

Describe the bug
STM32 Ethernet driver fails to build with CONFIG_ASSERT=1. This is introduced after the changeset under #25393 which added the following code,

/* Now that the iface is setup, we are safe to enable IRQs. */
__ASSERT_NO_MSG(DEV_CFG(dev)->config_func() != NULL);
DEV_CFG(dev)->config_func();

The assertion is supposed to validate that the function call is valid while here we invoke the function and compare with its output. As the function returns VOID, we get a build error with assertion enabled. Stupidity on my part and

Expected behavior
No build failure with Ethernet+Assert enabled.

Impact
Unable to build / test Ethernet. Regression.

Screenshots or console output

In file included from ../../../../../../include/kernel_includes.h:22,
                 from ../../../../../../include/kernel.h:17,
                 from /home/buildslave/src/github.com/zephyrproject-rtos/zephyr/drivers/ethernet/eth_stm32_hal.c:12:
/home/buildslave/src/github.com/zephyrproject-rtos/zephyr/drivers/ethernet/eth_stm32_hal.c: In function 'eth_iface_init':
/home/buildslave/src/github.com/zephyrproject-rtos/zephyr/drivers/ethernet/eth_stm32_hal_priv.h:48:3: error: void value not ignored as it ought to be
   48 |  ((const struct eth_stm32_hal_dev_cfg *)(dev)->config_info)
../../../../../../include/sys/__assert.h:86:9: note: in definition of macro '__ASSERT_NO_MSG'
   86 |   if (!(test)) {                                            \
      |         ^~~~
/home/buildslave/src/github.com/zephyrproject-rtos/zephyr/drivers/ethernet/eth_stm32_hal.c:481:19: note: in expansion of macro 'DEV_CFG'
  481 |   __ASSERT_NO_MSG(DEV_CFG(dev)->config_func() != NULL);
      |                   ^~~~~~~
[48/165] Building C object zephyr/arch/arch/arm/core/aarch32/cortex_m/CMakeFiles/arch__arm__core__aarch32__cortex_m.dir/scb.c.obj
@bwasim bwasim added the bug The issue is a bug, or the PR is fixing a bug label May 18, 2020
bwasim added a commit to bwasim/zephyr that referenced this issue May 18, 2020
The check for assertion on the "config_func" was added to
validate that the function pointer is valid. However, in
the code we are invoking the "config_func" and comparing
its output with NULL. This causes build failures with
CONFIG_ASSERT=1. Caused by PR-25393.

Tested on Nucleo F767Zi board.

Fixes zephyrproject-rtos#25427

Signed-off-by: Bilal Wasim <bilalwasim676@gmail.com>
@bwasim
Copy link
Contributor Author

bwasim commented May 18, 2020

cc: @erwango

@erwango erwango added platform: STM32 ST Micro STM32 priority: high High impact/importance bug labels May 19, 2020
@erwango erwango added this to the v2.3.0 milestone May 19, 2020
@pfalcon pfalcon added Hotfix Fix for issues blocking development, i.e. CI issues, tests failing in CI, etc. and removed Hotfix Fix for issues blocking development, i.e. CI issues, tests failing in CI, etc. labels May 19, 2020
carlescufi pushed a commit that referenced this issue May 19, 2020
The check for assertion on the "config_func" was added to
validate that the function pointer is valid. However, in
the code we are invoking the "config_func" and comparing
its output with NULL. This causes build failures with
CONFIG_ASSERT=1. Caused by PR-25393.

Tested on Nucleo F767Zi board.

Fixes #25427

Signed-off-by: Bilal Wasim <bilalwasim676@gmail.com>
oleg-krv pushed a commit to oleg-krv/zephyr-local that referenced this issue May 30, 2020
The check for assertion on the "config_func" was added to
validate that the function pointer is valid. However, in
the code we are invoking the "config_func" and comparing
its output with NULL. This causes build failures with
CONFIG_ASSERT=1. Caused by PR-25393.

Tested on Nucleo F767Zi board.

Fixes zephyrproject-rtos#25427

Signed-off-by: Bilal Wasim <bilalwasim676@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug The issue is a bug, or the PR is fixing a bug platform: STM32 ST Micro STM32 priority: high High impact/importance bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants