@@ -134,18 +134,22 @@ static inline struct eth_stm32_tx_context *allocate_tx_context(struct net_pkt *p
134
134
135
135
void eth_stm32_setup_mac_filter (ETH_HandleTypeDef * heth )
136
136
{
137
- __ASSERT_NO_MSG (heth != NULL );
138
137
ETH_MACFilterConfigTypeDef MACFilterConf ;
138
+ HAL_StatusTypeDef hal_ret ;
139
+
140
+ __ASSERT_NO_MSG (heth != NULL );
139
141
140
- HAL_ETH_GetMACFilterConfig (heth , & MACFilterConf );
142
+ hal_ret = HAL_ETH_GetMACFilterConfig (heth , & MACFilterConf );
143
+ __ASSERT_NO_MSG (hal_ret == HAL_OK );
141
144
142
145
MACFilterConf .HashMulticast =
143
146
IS_ENABLED (CONFIG_ETH_STM32_MULTICAST_FILTER ) ? ENABLE : DISABLE ;
144
147
MACFilterConf .PassAllMulticast =
145
148
IS_ENABLED (CONFIG_ETH_STM32_MULTICAST_FILTER ) ? DISABLE : ENABLE ;
146
149
MACFilterConf .HachOrPerfectFilter = DISABLE ;
147
150
148
- HAL_ETH_SetMACFilterConfig (heth , & MACFilterConf );
151
+ hal_ret = HAL_ETH_SetMACFilterConfig (heth , & MACFilterConf );
152
+ __ASSERT_NO_MSG (hal_ret == HAL_OK );
149
153
150
154
k_sleep (K_MSEC (1 ));
151
155
}
@@ -183,7 +187,9 @@ int eth_stm32_tx(const struct device *dev, struct net_pkt *pkt)
183
187
net_pkt_is_tx_timestamping (pkt );
184
188
if (timestamped_frame ) {
185
189
/* Enable transmit timestamp */
186
- HAL_ETH_PTP_InsertTxTimestamp (heth );
190
+ if (HAL_ETH_PTP_InsertTxTimestamp (heth ) != HAL_OK ) {
191
+ return - EIO ;
192
+ }
187
193
}
188
194
#endif /* CONFIG_PTP_CLOCK_STM32_HAL */
189
195
@@ -276,7 +282,9 @@ int eth_stm32_tx(const struct device *dev, struct net_pkt *pkt)
276
282
277
283
if (!ctx ) {
278
284
/* The HAL owns the tx context */
279
- HAL_ETH_ReleaseTxPacket (heth );
285
+ if (HAL_ETH_ReleaseTxPacket (heth ) != HAL_OK ) {
286
+ return - EIO ;
287
+ }
280
288
} else {
281
289
/* We need to release the tx context and its buffers */
282
290
HAL_ETH_TxFreeCallback ((uint32_t * )ctx );
@@ -529,7 +537,11 @@ void eth_stm32_set_mac_config(const struct device *dev, struct phy_link_state *s
529
537
HAL_StatusTypeDef hal_ret = HAL_OK ;
530
538
ETH_MACConfigTypeDef mac_config = {0 };
531
539
532
- HAL_ETH_GetMACConfig (heth , & mac_config );
540
+ if (HAL_ETH_GetMACConfig (heth , & mac_config ) != HAL_OK ) {
541
+ LOG_ERR ("HAL_ETH_GetMACConfig: failed: %d" , hal_ret );
542
+ ASSERT_NO_MSG (0 );
543
+ return ;
544
+ }
533
545
534
546
mac_config .DuplexMode =
535
547
PHY_LINK_IS_FULL_DUPLEX (state -> speed ) ? ETH_FULLDUPLEX_MODE : ETH_HALFDUPLEX_MODE ;
@@ -604,11 +616,15 @@ int eth_stm32_hal_set_config(const struct device *dev,
604
616
case ETHERNET_CONFIG_TYPE_PROMISC_MODE :
605
617
ETH_MACFilterConfigTypeDef MACFilterConf ;
606
618
607
- HAL_ETH_GetMACFilterConfig (heth , & MACFilterConf );
619
+ if (HAL_ETH_GetMACFilterConfig (heth , & MACFilterConf ) != HAL_OK ) {
620
+ return - EIO ;
621
+ }
608
622
609
623
MACFilterConf .PromiscuousMode = config -> promisc_mode ? ENABLE : DISABLE ;
610
624
611
- HAL_ETH_SetMACFilterConfig (heth , & MACFilterConf );
625
+ if (HAL_ETH_SetMACFilterConfig (heth , & MACFilterConf ) != HAL_OK ) {
626
+ return - EIO ;
627
+ }
612
628
return 0 ;
613
629
#endif /* CONFIG_NET_PROMISCUOUS_MODE */
614
630
#if defined(CONFIG_ETH_STM32_MULTICAST_FILTER )
0 commit comments