aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomasz Figa <tfiga@chromium.org>2017-11-15 06:55:22 -0500
committerMauro Carvalho Chehab <mchehab@s-opensource.com>2017-11-30 04:43:05 -0500
commit3bf393860f6efc41ce268f5c21a457df1e8e6e00 (patch)
tree7cbceadc9bd955a31d13467bf2b0d32590f64546
parent2aa4d4985fc526ce076bef68b3efe6013c20b975 (diff)
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> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
-rw-r--r--drivers/media/v4l2-core/v4l2-fwnode.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/media/v4l2-core/v4l2-fwnode.c b/drivers/media/v4l2-core/v4l2-fwnode.c
index 681b192420d9..fb72c7ac04d4 100644
--- a/drivers/media/v4l2-core/v4l2-fwnode.c
+++ b/drivers/media/v4l2-core/v4l2-fwnode.c
@@ -458,11 +458,6 @@ static int __v4l2_async_notifier_parse_fwnode_endpoints(
458 if (!is_available) 458 if (!is_available)
459 continue; 459 continue;
460 460
461 if (WARN_ON(notifier->num_subdevs >= notifier->max_subdevs)) {
462 ret = -EINVAL;
463 break;
464 }
465
466 if (has_port) { 461 if (has_port) {
467 struct fwnode_endpoint ep; 462 struct fwnode_endpoint ep;
468 463
@@ -474,6 +469,11 @@ static int __v4l2_async_notifier_parse_fwnode_endpoints(
474 continue; 469 continue;
475 } 470 }
476 471
472 if (WARN_ON(notifier->num_subdevs >= notifier->max_subdevs)) {
473 ret = -EINVAL;
474 break;
475 }
476
477 ret = v4l2_async_notifier_fwnode_parse_endpoint( 477 ret = v4l2_async_notifier_fwnode_parse_endpoint(
478 dev, notifier, fwnode, asd_struct_size, parse_endpoint); 478 dev, notifier, fwnode, asd_struct_size, parse_endpoint);
479 if (ret < 0) 479 if (ret < 0)