diff options
author | Sakari Ailus <sakari.ailus@linux.intel.com> | 2022-01-28 23:26:07 +0100 |
---|---|---|
committer | Sakari Ailus <sakari.ailus@linux.intel.com> | 2022-03-03 23:27:07 +0100 |
commit | 5f1501fd47882b1cf86ca232dd5d090cd9010ba2 (patch) | |
tree | 6f1beb864cd7ce995039b7f5203b275938d922b9 /drivers/media/v4l2-core | |
parent | v4l: fwnode: Drop redunant -ENODATA check in property reference parsing (diff) | |
download | linux-5f1501fd47882b1cf86ca232dd5d090cd9010ba2.tar.xz linux-5f1501fd47882b1cf86ca232dd5d090cd9010ba2.zip |
v4l: fwnode: Remove now-redundant loop from v4l2_fwnode_parse_reference()
v4l2_fwnode_parse_reference() relied on counting the number of references
for async array memory allocation. The array is long gone so remove
counting the references now.
This also changes how the function arrives in different unsuccessful
return values but the functionality remains unchanged.
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'drivers/media/v4l2-core')
-rw-r--r-- | drivers/media/v4l2-core/v4l2-fwnode.c | 24 |
1 files changed, 8 insertions, 16 deletions
diff --git a/drivers/media/v4l2-core/v4l2-fwnode.c b/drivers/media/v4l2-core/v4l2-fwnode.c index ae140443847b..afceb35e500c 100644 --- a/drivers/media/v4l2-core/v4l2-fwnode.c +++ b/drivers/media/v4l2-core/v4l2-fwnode.c @@ -894,21 +894,8 @@ static int v4l2_fwnode_reference_parse(struct device *dev, int ret; for (index = 0; - !(ret = fwnode_property_get_reference_args(dev_fwnode(dev), - prop, NULL, 0, - index, &args)); - index++) - fwnode_handle_put(args.fwnode); - - if (!index) - return -ENOENT; - - if (ret != -ENOENT) - return ret; - - for (index = 0; - !fwnode_property_get_reference_args(dev_fwnode(dev), prop, NULL, - 0, index, &args); + !(ret = fwnode_property_get_reference_args(dev_fwnode(dev), prop, + NULL, 0, index, &args)); index++) { struct v4l2_async_subdev *asd; @@ -924,7 +911,12 @@ static int v4l2_fwnode_reference_parse(struct device *dev, } } - return 0; + /* -ENOENT here means successful parsing */ + if (ret != -ENOENT) + return ret; + + /* Return -ENOENT if no references were found */ + return index ? 0 : -ENOENT; } /* |