FROMLIST: 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: 9ca4653121 ("media: v4l: fwnode: Support generic parsing of graph endpoints in a device")
Signed-off-by: Tomasz Figa <tfiga@chromium.org>
(am from https://patchwork.linuxtv.org/patch/45462/)

BUG=b:36227021
TEST=WiP Rockchip ISP driver probes without errors on Scarlet

Change-Id: Ie4d160af21d5dedde7e73e3f1a0819a0d5d4f340
Signed-off-by: Jacob Chen <jacob2.chen@rock-chips.com>
This commit is contained in:
Tomasz Figa
2017-11-14 20:11:09 +09:00
committed by Tao Huang
parent 255a3eb2b7
commit 80072db056

View File

@@ -410,11 +410,6 @@ static int __v4l2_async_notifier_parse_fwnode_endpoints(
if (!fwnode_device_is_available(dev_fwnode))
continue;
if (WARN_ON(notifier->num_subdevs >= notifier->max_subdevs)) {
ret = -EINVAL;
break;
}
if (has_port) {
struct fwnode_endpoint ep;
@@ -426,6 +421,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)