Skip to content

Commit 3bf3938

Browse files
tom3qmchehab
authored andcommitted
media: v4l2-fwnode: Check subdev count after checking port
Current implementation of __v4l2_async_notifier_parse_fwnode_endpoints() checks first whether subdev_count >= subdev_max and only then whether the port being parsed matches the given port index. This triggers an error in otherwise valid cases of skipping ports that do not match. Fix this by moving the check below the port index check. Fixes: 9ca4653 ("media: v4l: fwnode: Support generic parsing of graph endpoints in a device") Signed-off-by: Tomasz Figa <[email protected]> Signed-off-by: Sakari Ailus <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
1 parent 2aa4d49 commit 3bf3938

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

drivers/media/v4l2-core/v4l2-fwnode.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -458,11 +458,6 @@ static int __v4l2_async_notifier_parse_fwnode_endpoints(
458458
if (!is_available)
459459
continue;
460460

461-
if (WARN_ON(notifier->num_subdevs >= notifier->max_subdevs)) {
462-
ret = -EINVAL;
463-
break;
464-
}
465-
466461
if (has_port) {
467462
struct fwnode_endpoint ep;
468463

@@ -474,6 +469,11 @@ static int __v4l2_async_notifier_parse_fwnode_endpoints(
474469
continue;
475470
}
476471

472+
if (WARN_ON(notifier->num_subdevs >= notifier->max_subdevs)) {
473+
ret = -EINVAL;
474+
break;
475+
}
476+
477477
ret = v4l2_async_notifier_fwnode_parse_endpoint(
478478
dev, notifier, fwnode, asd_struct_size, parse_endpoint);
479479
if (ret < 0)

0 commit comments

Comments
 (0)