Skip to content

Commit 4ad088e

Browse files
committed
drivers: video: stm32-dcmi: Drop video_stm32_dcmi_is_fmt_valid
Drop video_stm32_dcmi_is_fmt_valid() as it is not needed. In this function, (i) checking against a format based on another utility function video_bits_per_pixel() is not robust, this check is done in the sensor driver, (ii) checking against the heap size is not appropriate because this should be done when allocating buffers, not in get/set format. Signed-off-by: Phi Bang Nguyen <phibang.nguyen@nxp.com>
1 parent 7316e7f commit 4ad088e

File tree

1 file changed

+0
-27
lines changed

1 file changed

+0
-27
lines changed

drivers/video/video_stm32_dcmi.c

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -186,17 +186,6 @@ static int stm32_dcmi_enable_clock(const struct device *dev)
186186
return clock_control_on(dcmi_clock, (clock_control_subsys_t *)&config->pclken);
187187
}
188188

189-
static inline int video_stm32_dcmi_is_fmt_valid(uint32_t pixelformat, uint32_t pitch,
190-
uint32_t height)
191-
{
192-
if (video_bits_per_pixel(pixelformat) / BITS_PER_BYTE == 0 ||
193-
pitch * height > CONFIG_VIDEO_BUFFER_POOL_SZ_MAX) {
194-
return -EINVAL;
195-
}
196-
197-
return 0;
198-
}
199-
200189
static int video_stm32_dcmi_set_fmt(const struct device *dev,
201190
enum video_endpoint_id ep,
202191
struct video_format *fmt)
@@ -209,11 +198,6 @@ static int video_stm32_dcmi_set_fmt(const struct device *dev,
209198
return -EINVAL;
210199
}
211200

212-
ret = video_stm32_dcmi_is_fmt_valid(fmt->pixelformat, fmt->pitch, fmt->height);
213-
if (ret < 0) {
214-
return ret;
215-
}
216-
217201
ret = video_set_format(config->sensor_dev, ep, fmt);
218202
if (ret < 0) {
219203
return ret;
@@ -242,11 +226,6 @@ static int video_stm32_dcmi_get_fmt(const struct device *dev,
242226
return ret;
243227
}
244228

245-
ret = video_stm32_dcmi_is_fmt_valid(fmt->pixelformat, fmt->pitch, fmt->height);
246-
if (ret < 0) {
247-
return ret;
248-
}
249-
250229
data->fmt = *fmt;
251230

252231
return 0;
@@ -372,12 +351,6 @@ static int video_stm32_dcmi_enum_frmival(const struct device *dev, enum video_en
372351
return -EINVAL;
373352
}
374353

375-
ret = video_stm32_dcmi_is_fmt_valid(fie->format->pixelformat, fie->format->pitch,
376-
fie->format->height);
377-
if (ret < 0) {
378-
return ret;
379-
}
380-
381354
ret = video_enum_frmival(config->sensor_dev, ep, fie);
382355
if (ret < 0) {
383356
return ret;

0 commit comments

Comments
 (0)