Skip to content

Commit 745d762

Browse files
maass-hamburgkartben
authored andcommitted
eth: stm32: streamline eth_initialize function
streamline eth_initialize function by removing redundant variable assignments Signed-off-by: Fin Maaß <[email protected]>
1 parent bccd8ab commit 745d762

File tree

1 file changed

+3
-13
lines changed

1 file changed

+3
-13
lines changed

drivers/ethernet/eth_stm32_hal.c

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -875,19 +875,11 @@ static void RISAF_Config(void)
875875

876876
static int eth_initialize(const struct device *dev)
877877
{
878-
struct eth_stm32_hal_dev_data *dev_data;
879-
const struct eth_stm32_hal_dev_cfg *cfg;
880-
ETH_HandleTypeDef *heth;
878+
struct eth_stm32_hal_dev_data *dev_data = dev->data;
879+
const struct eth_stm32_hal_dev_cfg *cfg = dev->config;
880+
ETH_HandleTypeDef *heth = &dev_data->heth;
881881
int ret = 0;
882882

883-
__ASSERT_NO_MSG(dev != NULL);
884-
885-
dev_data = dev->data;
886-
cfg = dev->config;
887-
888-
__ASSERT_NO_MSG(dev_data != NULL);
889-
__ASSERT_NO_MSG(cfg != NULL);
890-
891883
if (!device_is_ready(DEVICE_DT_GET(STM32_CLOCK_CONTROL_NODE))) {
892884
LOG_ERR("clock control device not ready");
893885
return -ENODEV;
@@ -922,8 +914,6 @@ static int eth_initialize(const struct device *dev)
922914
return ret;
923915
}
924916

925-
heth = &dev_data->heth;
926-
927917
generate_mac(dev_data->mac_addr);
928918

929919
heth->Init.MACAddr = dev_data->mac_addr;

0 commit comments

Comments
 (0)