Commit 3bf39386 authored by Tomasz Figa's avatar Tomasz Figa Committed by Mauro Carvalho Chehab

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: 9ca46531 ("media: v4l: fwnode: Support generic parsing of graph endpoints in a device")
Signed-off-by: default avatarTomasz Figa <tfiga@chromium.org>
Signed-off-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent 2aa4d498
......@@ -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;
......@@ -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)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment