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

drivers: eth: stm32: Fix invalid assertion check #25428

Merged

Conversation

bwasim
Copy link
Contributor

@bwasim bwasim commented 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 #25427

Signed-off-by: Bilal Wasim bilalwasim676@gmail.com

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

Build failure in shippable not seen under #25393, but seen under #25397.. Here's the log,

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 changed the title drivers: eth: stm32: Fix invalid assertion comparison drivers: eth: stm32: Fix invalid assertion check May 18, 2020
@erwango erwango added the bug The issue is a bug, or the PR is fixing a bug label May 19, 2020
@erwango erwango added this to the v2.3.0 milestone May 19, 2020
@erwango erwango added the priority: high High impact/importance bug label May 19, 2020
@erwango erwango added the Hotfix Fix for issues blocking development, i.e. CI issues, tests failing in CI, etc. label May 19, 2020
@jukkar jukkar added the Trivial Changes that can be reviewed by anyone, i.e. doc changes, minor build system tweaks, etc. label May 19, 2020
@pfalcon
Copy link
Contributor

pfalcon commented May 19, 2020

@carlescufi: Can you please merge this, there're reports that it breaks CI.

@carlescufi carlescufi merged commit 190ade9 into zephyrproject-rtos:master May 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Ethernet bug The issue is a bug, or the PR is fixing a bug Hotfix Fix for issues blocking development, i.e. CI issues, tests failing in CI, etc. platform: STM32 ST Micro STM32 priority: high High impact/importance bug Trivial Changes that can be reviewed by anyone, i.e. doc changes, minor build system tweaks, etc.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

STM32 Ethernet driver build failure with CONFIG_ASSERT=1
5 participants