Skip to content

drivers: video: common: API misuse in video_closest_frmival() #89663

Closed
@josuah

Description

@josuah

Describe the bug

video_closest_frmival() is expecting the driver to increment fie.index. This is not the correct API and having this in video_common.c and video_emul_imager.c is misleading. The tests is also wrong.

To Reproduce

The CI passes while it should fail as the test is testing the wrong thing:

/* Do a first enumeration of frame intervals, expected to work */
zexpect_ok(video_enum_frmival(imager_dev, VIDEO_EP_OUT, &fie));
zexpect_equal(fie.index, 1, "fie's index should increment by one at every iteration");

Expected behavior

The driver does not increment fie.index, the caller does.

Impact

No public code currently uses it, but developers building new code will be confused.

Logs and console output

Environment (please complete the following information):

CI

Additional context

A PR to fix it is already proposed here:

But only one commit out of it is for the actual fix and can be split:

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions