@@ -134,18 +134,22 @@ static inline struct eth_stm32_tx_context *allocate_tx_context(struct net_pkt *p
134134
135135void eth_stm32_setup_mac_filter (ETH_HandleTypeDef * heth )
136136{
137- __ASSERT_NO_MSG (heth != NULL );
138137 ETH_MACFilterConfigTypeDef MACFilterConf ;
138+ HAL_StatusTypeDef __maybe_unused hal_ret ;
139+
140+ __ASSERT_NO_MSG (heth != NULL );
139141
140- HAL_ETH_GetMACFilterConfig (heth , & MACFilterConf );
142+ hal_ret = HAL_ETH_GetMACFilterConfig (heth , & MACFilterConf );
143+ __ASSERT_NO_MSG (hal_ret == HAL_OK );
141144
142145 MACFilterConf .HashMulticast =
143146 IS_ENABLED (CONFIG_ETH_STM32_MULTICAST_FILTER ) ? ENABLE : DISABLE ;
144147 MACFilterConf .PassAllMulticast =
145148 IS_ENABLED (CONFIG_ETH_STM32_MULTICAST_FILTER ) ? DISABLE : ENABLE ;
146149 MACFilterConf .HachOrPerfectFilter = DISABLE ;
147150
148- HAL_ETH_SetMACFilterConfig (heth , & MACFilterConf );
151+ hal_ret = HAL_ETH_SetMACFilterConfig (heth , & MACFilterConf );
152+ __ASSERT_NO_MSG (hal_ret == HAL_OK );
149153
150154 k_sleep (K_MSEC (1 ));
151155}
@@ -183,7 +187,9 @@ int eth_stm32_tx(const struct device *dev, struct net_pkt *pkt)
183187 net_pkt_is_tx_timestamping (pkt );
184188 if (timestamped_frame ) {
185189 /* Enable transmit timestamp */
186- HAL_ETH_PTP_InsertTxTimestamp (heth );
190+ if (HAL_ETH_PTP_InsertTxTimestamp (heth ) != HAL_OK ) {
191+ return - EIO ;
192+ }
187193 }
188194#endif /* CONFIG_PTP_CLOCK_STM32_HAL */
189195
@@ -276,7 +282,9 @@ int eth_stm32_tx(const struct device *dev, struct net_pkt *pkt)
276282
277283 if (!ctx ) {
278284 /* The HAL owns the tx context */
279- HAL_ETH_ReleaseTxPacket (heth );
285+ if (HAL_ETH_ReleaseTxPacket (heth ) != HAL_OK ) {
286+ return - EIO ;
287+ }
280288 } else {
281289 /* We need to release the tx context and its buffers */
282290 HAL_ETH_TxFreeCallback ((uint32_t * )ctx );
@@ -529,7 +537,12 @@ void eth_stm32_set_mac_config(const struct device *dev, struct phy_link_state *s
529537 HAL_StatusTypeDef hal_ret = HAL_OK ;
530538 ETH_MACConfigTypeDef mac_config = {0 };
531539
532- HAL_ETH_GetMACConfig (heth , & mac_config );
540+ hal_ret = HAL_ETH_GetMACConfig (heth , & mac_config );
541+ if (hal_ret != HAL_OK ) {
542+ LOG_ERR ("HAL_ETH_GetMACConfig failed: %d" , hal_ret );
543+ __ASSERT_NO_MSG (0 );
544+ return ;
545+ }
533546
534547 mac_config .DuplexMode =
535548 PHY_LINK_IS_FULL_DUPLEX (state -> speed ) ? ETH_FULLDUPLEX_MODE : ETH_HALFDUPLEX_MODE ;
@@ -541,7 +554,8 @@ void eth_stm32_set_mac_config(const struct device *dev, struct phy_link_state *s
541554
542555 hal_ret = HAL_ETH_SetMACConfig (heth , & mac_config );
543556 if (hal_ret != HAL_OK ) {
544- LOG_ERR ("HAL_ETH_SetMACConfig: failed: %d" , hal_ret );
557+ LOG_ERR ("HAL_ETH_SetMACConfig failed: %d" , hal_ret );
558+ __ASSERT_NO_MSG (0 );
545559 }
546560}
547561
@@ -604,11 +618,15 @@ int eth_stm32_hal_set_config(const struct device *dev,
604618 case ETHERNET_CONFIG_TYPE_PROMISC_MODE :
605619 ETH_MACFilterConfigTypeDef MACFilterConf ;
606620
607- HAL_ETH_GetMACFilterConfig (heth , & MACFilterConf );
621+ if (HAL_ETH_GetMACFilterConfig (heth , & MACFilterConf ) != HAL_OK ) {
622+ return - EIO ;
623+ }
608624
609625 MACFilterConf .PromiscuousMode = config -> promisc_mode ? ENABLE : DISABLE ;
610626
611- HAL_ETH_SetMACFilterConfig (heth , & MACFilterConf );
627+ if (HAL_ETH_SetMACFilterConfig (heth , & MACFilterConf ) != HAL_OK ) {
628+ return - EIO ;
629+ }
612630 return 0 ;
613631#endif /* CONFIG_NET_PROMISCUOUS_MODE */
614632#if defined(CONFIG_ETH_STM32_MULTICAST_FILTER )
0 commit comments