UPSTREAM: media: v4l2-fwnode: link_frequency is an optional property

v4l2_fwnode_endpoint_alloc_parse() is intended as a replacement for
v4l2_fwnode_endpoint_parse(). It parses the "link-frequency" property and
if the property isn't found, it returns an error. However,
"link-frequency" is an optional property and if it does not exist is not
an error. Instead, the number of link frequencies is simply zero in that
case.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Niklas Sderlund <niklas.soderlund+renesas@ragnatech.se>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
(cherry picked from commit 06f8152027)
Signed-off-by: Marc Herbert <marc.herbert@intel.com>

BUG=b:64133998
TEST=media device topology shows subdevs registered successfully
TEST=no camera regression

Change-Id: I762fe01c77a6cac8f8ec415a2d68a6707e331159
Reviewed-on: https://chromium-review.googlesource.com/711075
Commit-Ready: Tomasz Figa <tfiga@chromium.org>
Tested-by: Hyungwoo Yang <hyungwoo.yang@intel.com>
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Signed-off-by: Jacob Chen <jacob2.chen@rock-chips.com>
This commit is contained in:
Sakari Ailus
2017-06-20 09:14:43 -04:00
committed by Tao Huang
parent 1ced1aecf4
commit c46d1b7529

View File

@@ -247,24 +247,24 @@ struct v4l2_fwnode_endpoint *v4l2_fwnode_endpoint_alloc_parse(
rval = fwnode_property_read_u64_array(fwnode, "link-frequencies",
NULL, 0);
if (rval < 0)
goto out_err;
if (rval > 0) {
vep->link_frequencies =
kmalloc_array(rval, sizeof(*vep->link_frequencies),
GFP_KERNEL);
if (!vep->link_frequencies) {
rval = -ENOMEM;
goto out_err;
}
vep->link_frequencies =
kmalloc_array(rval, sizeof(*vep->link_frequencies), GFP_KERNEL);
if (!vep->link_frequencies) {
rval = -ENOMEM;
goto out_err;
vep->nr_of_link_frequencies = rval;
rval = fwnode_property_read_u64_array(
fwnode, "link-frequencies", vep->link_frequencies,
vep->nr_of_link_frequencies);
if (rval < 0)
goto out_err;
}
vep->nr_of_link_frequencies = rval;
rval = fwnode_property_read_u64_array(fwnode, "link-frequencies",
vep->link_frequencies,
vep->nr_of_link_frequencies);
if (rval < 0)
goto out_err;
return vep;
out_err: