File tree 12 files changed +52
-17
lines changed
12 files changed +52
-17
lines changed Original file line number Diff line number Diff line change @@ -499,7 +499,11 @@ static int dma_stm32_init(struct device *dev)
499
499
500
500
__ASSERT_NO_MSG (ddata -> clk );
501
501
502
- clock_control_on (ddata -> clk , (clock_control_subsys_t * ) & cdata -> pclken );
502
+ if (clock_control_on (ddata -> clk ,
503
+ (clock_control_subsys_t * ) & cdata -> pclken ) != 0 ) {
504
+ LOG_ERR ("Could not enable DMA clock\n" );
505
+ return - EIO ;
506
+ }
503
507
504
508
/* Set controller specific configuration */
505
509
cdata -> config (ddata );
Original file line number Diff line number Diff line change @@ -151,6 +151,7 @@ static int entropy_stm32_rng_init(struct device *dev)
151
151
{
152
152
struct entropy_stm32_rng_dev_data * dev_data ;
153
153
struct entropy_stm32_rng_dev_cfg * dev_cfg ;
154
+ int res ;
154
155
155
156
__ASSERT_NO_MSG (dev != NULL );
156
157
@@ -186,8 +187,9 @@ static int entropy_stm32_rng_init(struct device *dev)
186
187
dev_data -> clock = device_get_binding (STM32_CLOCK_CONTROL_NAME );
187
188
__ASSERT_NO_MSG (dev_data -> clock != NULL );
188
189
189
- clock_control_on (dev_data -> clock ,
190
+ res = clock_control_on (dev_data -> clock ,
190
191
(clock_control_subsys_t * )& dev_cfg -> pclken );
192
+ __ASSERT_NO_MSG (res );
191
193
192
194
LL_RNG_Enable (dev_data -> rng );
193
195
Original file line number Diff line number Diff line change @@ -263,6 +263,7 @@ static int eth_initialize(struct device *dev)
263
263
{
264
264
struct eth_stm32_hal_dev_data * dev_data ;
265
265
struct eth_stm32_hal_dev_cfg * cfg ;
266
+ int ret = 0 ;
266
267
267
268
__ASSERT_NO_MSG (dev != NULL );
268
269
@@ -276,15 +277,20 @@ static int eth_initialize(struct device *dev)
276
277
__ASSERT_NO_MSG (dev_data -> clock != NULL );
277
278
278
279
/* enable clock */
279
- clock_control_on (dev_data -> clock ,
280
+ ret = clock_control_on (dev_data -> clock ,
280
281
(clock_control_subsys_t * )& cfg -> pclken );
281
- clock_control_on (dev_data -> clock ,
282
+ ret |= clock_control_on (dev_data -> clock ,
282
283
(clock_control_subsys_t * )& cfg -> pclken_tx );
283
- clock_control_on (dev_data -> clock ,
284
+ ret |= clock_control_on (dev_data -> clock ,
284
285
(clock_control_subsys_t * )& cfg -> pclken_rx );
285
- clock_control_on (dev_data -> clock ,
286
+ ret |= clock_control_on (dev_data -> clock ,
286
287
(clock_control_subsys_t * )& cfg -> pclken_ptp );
287
288
289
+ if (ret ) {
290
+ LOG_ERR ("Failed to enable ethernet clock" );
291
+ return - EIO ;
292
+ }
293
+
288
294
__ASSERT_NO_MSG (cfg -> config_func != NULL );
289
295
290
296
cfg -> config_func ();
Original file line number Diff line number Diff line change @@ -252,7 +252,9 @@ static int stm32_flash_init(struct device *dev)
252
252
#endif
253
253
254
254
/* enable clock */
255
- clock_control_on (clk , (clock_control_subsys_t * )& p -> pclken );
255
+ if (clock_control_on (clk , (clock_control_subsys_t * )& p -> pclken ) != 0 ) {
256
+ return - EIO ;
257
+ }
256
258
#endif
257
259
258
260
k_sem_init (& p -> sem , 1 , 1 );
Original file line number Diff line number Diff line change @@ -192,7 +192,10 @@ static int gpio_stm32_init(struct device *device)
192
192
struct device * clk =
193
193
device_get_binding (STM32_CLOCK_CONTROL_NAME );
194
194
195
- clock_control_on (clk , (clock_control_subsys_t * ) & cfg -> pclken );
195
+ if (clock_control_on (clk ,
196
+ (clock_control_subsys_t * ) & cfg -> pclken ) != 0 ) {
197
+ return - EIO ;
198
+ }
196
199
197
200
return 0 ;
198
201
}
Original file line number Diff line number Diff line change @@ -170,7 +170,11 @@ static int i2c_stm32_init(struct device *dev)
170
170
#endif
171
171
172
172
__ASSERT_NO_MSG (clock );
173
- clock_control_on (clock , (clock_control_subsys_t * ) & cfg -> pclken );
173
+ if (clock_control_on (clock ,
174
+ (clock_control_subsys_t * ) & cfg -> pclken ) != 0 ) {
175
+ LOG_ERR ("i2c: failure enabling clock" );
176
+ return - EIO ;
177
+ }
174
178
175
179
#if defined(CONFIG_SOC_SERIES_STM32F3X ) || defined(CONFIG_SOC_SERIES_STM32F0X )
176
180
/*
Original file line number Diff line number Diff line change @@ -99,6 +99,7 @@ static int i2s_stm32_enable_clock(struct device *dev)
99
99
100
100
ret = clock_control_on (clk , (clock_control_subsys_t * ) & cfg -> pclken );
101
101
if (ret != 0 ) {
102
+ LOG_ERR ("Could not enable I2S clock" );
102
103
return - EIO ;
103
104
}
104
105
Original file line number Diff line number Diff line change @@ -196,8 +196,10 @@ static int pwm_stm32_init(struct device *dev)
196
196
__pwm_stm32_get_clock (dev );
197
197
198
198
/* enable clock */
199
- clock_control_on (data -> clock ,
200
- (clock_control_subsys_t * )& config -> pclken );
199
+ if (clock_control_on (data -> clock ,
200
+ (clock_control_subsys_t * )& config -> pclken ) != 0 ) {
201
+ return - EIO ;
202
+ }
201
203
202
204
return 0 ;
203
205
}
Original file line number Diff line number Diff line change @@ -214,7 +214,10 @@ static int rtc_stm32_init(struct device *dev)
214
214
k_sem_init (DEV_SEM (dev ), 1 , UINT_MAX );
215
215
DEV_DATA (dev )-> cb_fn = NULL ;
216
216
217
- clock_control_on (clk , (clock_control_subsys_t * ) & cfg -> pclken );
217
+ if (clock_control_on (clk ,
218
+ (clock_control_subsys_t * ) & cfg -> pclken ) != 0 ) {
219
+ return - EIO ;
220
+ }
218
221
219
222
LL_PWR_EnableBkUpAccess ();
220
223
LL_RCC_ForceBackupDomainReset ();
Original file line number Diff line number Diff line change @@ -311,8 +311,10 @@ static int uart_stm32_init(struct device *dev)
311
311
312
312
__uart_stm32_get_clock (dev );
313
313
/* enable clock */
314
- clock_control_on (data -> clock ,
315
- (clock_control_subsys_t * )& config -> pclken );
314
+ if (clock_control_on (data -> clock ,
315
+ (clock_control_subsys_t * )& config -> pclken ) != 0 ) {
316
+ return - EIO ;
317
+ }
316
318
317
319
LL_USART_Disable (UartInstance );
318
320
Original file line number Diff line number Diff line change @@ -465,8 +465,11 @@ static int spi_stm32_init(struct device *dev)
465
465
466
466
__ASSERT_NO_MSG (device_get_binding (STM32_CLOCK_CONTROL_NAME ));
467
467
468
- clock_control_on (device_get_binding (STM32_CLOCK_CONTROL_NAME ),
469
- (clock_control_subsys_t ) & cfg -> pclken );
468
+ if (clock_control_on (device_get_binding (STM32_CLOCK_CONTROL_NAME ),
469
+ (clock_control_subsys_t ) & cfg -> pclken ) != 0 ) {
470
+ LOG_ERR ("Could not enable SPI clock" );
471
+ return - EIO ;
472
+ }
470
473
471
474
#ifdef CONFIG_SPI_STM32_INTERRUPT
472
475
cfg -> irq_config (dev );
Original file line number Diff line number Diff line change @@ -253,7 +253,10 @@ static int usb_dc_stm32_clock_enable(void)
253
253
}
254
254
#endif /* RCC_HSI48_SUPPORT / LL_RCC_USB_CLKSOURCE_NONE */
255
255
256
- clock_control_on (clk , (clock_control_subsys_t * )& pclken );
256
+ if (clock_control_on (clk , (clock_control_subsys_t * )& pclken ) != 0 ) {
257
+ LOG_ERR ("Unable to enable USB clock" );
258
+ return - EIO ;
259
+ }
257
260
258
261
#ifdef DT_USB_HS_BASE_ADDRESS
259
262
You can’t perform that action at this time.
0 commit comments