Skip to content

Commit 495e37b

Browse files
committed
drivers: video: stm32: test HAL functions return value
Add missing test of some HAL functions return value. Signed-off-by: Etienne Carriere <[email protected]>
1 parent 2207735 commit 495e37b

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

drivers/video/video_stm32_dcmi.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,10 @@ void HAL_DCMI_FrameEventCallback(DCMI_HandleTypeDef *hdcmi)
6565
struct video_stm32_dcmi_data *dev_data =
6666
CONTAINER_OF(hdcmi, struct video_stm32_dcmi_data, hdcmi);
6767
struct video_buffer *vbuf;
68+
HAL_StatusTypeDef __maybe_unused hal_ret;
6869

69-
HAL_DCMI_Suspend(hdcmi);
70+
hal_ret = HAL_DCMI_Suspend(hdcmi);
71+
__ASSERT_NO_MSG(hal_ret == HAL_OK);
7072

7173
vbuf = k_fifo_get(&dev_data->fifo_in, K_NO_WAIT);
7274

@@ -81,7 +83,8 @@ void HAL_DCMI_FrameEventCallback(DCMI_HandleTypeDef *hdcmi)
8183
k_fifo_put(&dev_data->fifo_out, vbuf);
8284

8385
resume:
84-
HAL_DCMI_Resume(hdcmi);
86+
hal_ret = HAL_DCMI_Resume(hdcmi);
87+
__ASSERT_NO_MSG(hal_ret == HAL_OK);
8588
}
8689

8790
static void stm32_dcmi_isr(const struct device *dev)

drivers/video/video_stm32_dcmipp.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1202,12 +1202,18 @@ static int stm32_dcmipp_stream_enable(const struct device *dev)
12021202
if (ret < 0) {
12031203
LOG_ERR("Failed to start the source");
12041204
if (config->bus_type == VIDEO_BUS_TYPE_PARALLEL) {
1205-
HAL_DCMIPP_PIPE_Stop(&dcmipp->hdcmipp, pipe->id);
1205+
if (HAL_DCMIPP_PIPE_Stop(&dcmipp->hdcmipp, pipe->id) != HAL_OK) {
1206+
ret = -EIO;
1207+
goto out;
1208+
}
12061209
}
12071210
#if defined(STM32_DCMIPP_HAS_CSI)
12081211
else if (config->bus_type == VIDEO_BUS_TYPE_CSI2_DPHY) {
1209-
HAL_DCMIPP_CSI_PIPE_Stop(&dcmipp->hdcmipp, pipe->id,
1210-
DCMIPP_VIRTUAL_CHANNEL0);
1212+
if (HAL_DCMIPP_CSI_PIPE_Stop(&dcmipp->hdcmipp, pipe->id,
1213+
DCMIPP_VIRTUAL_CHANNEL0) != HAL_OK) {
1214+
ret = -EIO;
1215+
goto out;
1216+
}
12111217
}
12121218
#endif
12131219
else {

0 commit comments

Comments
 (0)