Skip to content

Commit 0b090fa

Browse files
ngphibangkartben
authored andcommitted
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 fcadb79 commit 0b090fa

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,28 +186,12 @@ 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, struct video_format *fmt)
201190
{
202191
const struct video_stm32_dcmi_config *config = dev->config;
203192
struct video_stm32_dcmi_data *data = dev->data;
204193
int ret;
205194

206-
ret = video_stm32_dcmi_is_fmt_valid(fmt->pixelformat, fmt->pitch, fmt->height);
207-
if (ret < 0) {
208-
return ret;
209-
}
210-
211195
ret = video_set_format(config->sensor_dev, fmt);
212196
if (ret < 0) {
213197
return ret;
@@ -234,11 +218,6 @@ static int video_stm32_dcmi_get_fmt(const struct device *dev, struct video_forma
234218
return ret;
235219
}
236220

237-
ret = video_stm32_dcmi_is_fmt_valid(fmt->pixelformat, fmt->pitch, fmt->height);
238-
if (ret < 0) {
239-
return ret;
240-
}
241-
242221
data->fmt = *fmt;
243222

244223
return 0;
@@ -342,12 +321,6 @@ static int video_stm32_dcmi_enum_frmival(const struct device *dev, struct video_
342321
const struct video_stm32_dcmi_config *config = dev->config;
343322
int ret;
344323

345-
ret = video_stm32_dcmi_is_fmt_valid(fie->format->pixelformat, fie->format->pitch,
346-
fie->format->height);
347-
if (ret < 0) {
348-
return ret;
349-
}
350-
351324
ret = video_enum_frmival(config->sensor_dev, fie);
352325
if (ret < 0) {
353326
return ret;

0 commit comments

Comments
 (0)