Skip to content

Commit 80072db

Browse files
tom3qrkhuangtao
authored andcommitted
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: 9ca465312132 ("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>
1 parent 255a3eb commit 80072db

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -410,11 +410,6 @@ static int __v4l2_async_notifier_parse_fwnode_endpoints(
410410
if (!fwnode_device_is_available(dev_fwnode))
411411
continue;
412412

413-
if (WARN_ON(notifier->num_subdevs >= notifier->max_subdevs)) {
414-
ret = -EINVAL;
415-
break;
416-
}
417-
418413
if (has_port) {
419414
struct fwnode_endpoint ep;
420415

@@ -426,6 +421,11 @@ static int __v4l2_async_notifier_parse_fwnode_endpoints(
426421
continue;
427422
}
428423

424+
if (WARN_ON(notifier->num_subdevs >= notifier->max_subdevs)) {
425+
ret = -EINVAL;
426+
break;
427+
}
428+
429429
ret = v4l2_async_notifier_fwnode_parse_endpoint(
430430
dev, notifier, fwnode, asd_struct_size, parse_endpoint);
431431
if (ret < 0)

0 commit comments

Comments
 (0)