Skip to content

Commit 49cd5ee

Browse files
author
Alain Volmat
committed
isp_wrapper: check sensor pointer at init time
Add an assert in the stm32_dcmipp_isp_init function to check the validity of the sensor parameter. This pointer is later on used by all ISP ops. Signed-off-by: Alain Volmat <[email protected]>
1 parent fa23d42 commit 49cd5ee

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

isp_wrapper/src/isp_wrapper.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,6 @@ static ISP_StatusTypeDef isp_SetSensorGain(uint32_t Instance, int32_t Gain)
6868
struct video_control ctrl;
6969
int ret;
7070

71-
assert(sensor_i);
72-
7371
ctrl.id = VIDEO_CID_ANALOGUE_GAIN;
7472
ctrl.val = Gain;
7573
ret = video_set_ctrl(sensor_i, &ctrl);
@@ -97,8 +95,6 @@ static ISP_StatusTypeDef isp_SetSensorExposure(uint32_t Instance, int32_t Exposu
9795
struct video_control ctrl;
9896
int ret;
9997

100-
assert(sensor_i);
101-
10298
ctrl.id = VIDEO_CID_EXPOSURE;
10399
ctrl.val = Exposure / IMX335_1H_PERIOD_USEC;
104100
ret = video_set_ctrl(sensor_i, &ctrl);
@@ -148,6 +144,8 @@ int stm32_dcmipp_isp_init(DCMIPP_HandleTypeDef *hdcmipp, const struct device *se
148144
k_tid_t isp_tid;
149145
int res;
150146

147+
assert(sensor);
148+
151149
sensor_i = sensor;
152150
res = ISP_Init(&isp_i, hdcmipp, 0, &isp_helpers, &ISP_IQParamCacheInit_IMX335);
153151
if (res)

0 commit comments

Comments
 (0)