Skip to content

Commit

Permalink
media: v4l2-fwnode: Check subdev count after checking port
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
tom3q authored and mchehab committed Nov 30, 2017
1 parent 2aa4d49 commit 3bf3938
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions drivers/media/v4l2-core/v4l2-fwnode.c
Original file line number Diff line number Diff line change
Expand Up @@ -458,11 +458,6 @@ static int __v4l2_async_notifier_parse_fwnode_endpoints(
if (!is_available)
continue;

if (WARN_ON(notifier->num_subdevs >= notifier->max_subdevs)) {
ret = -EINVAL;
break;
}

if (has_port) {
struct fwnode_endpoint ep;

Expand All @@ -474,6 +469,11 @@ static int __v4l2_async_notifier_parse_fwnode_endpoints(
continue;
}

if (WARN_ON(notifier->num_subdevs >= notifier->max_subdevs)) {
ret = -EINVAL;
break;
}

ret = v4l2_async_notifier_fwnode_parse_endpoint(
dev, notifier, fwnode, asd_struct_size, parse_endpoint);
if (ret < 0)
Expand Down

0 comments on commit 3bf3938

Please sign in to comment.