Skip to content

Commit c46d1b7

Browse files
Sakari Ailusrkhuangtao
authored andcommitted
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 06f8152027765e55da3afc23d87c5fdaf9e7a686) 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>
1 parent 1ced1ae commit c46d1b7

1 file changed

Lines changed: 15 additions & 15 deletions

File tree

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

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -247,23 +247,23 @@ struct v4l2_fwnode_endpoint *v4l2_fwnode_endpoint_alloc_parse(
247247

248248
rval = fwnode_property_read_u64_array(fwnode, "link-frequencies",
249249
NULL, 0);
250-
if (rval < 0)
251-
goto out_err;
252-
253-
vep->link_frequencies =
254-
kmalloc_array(rval, sizeof(*vep->link_frequencies), GFP_KERNEL);
255-
if (!vep->link_frequencies) {
256-
rval = -ENOMEM;
257-
goto out_err;
258-
}
250+
if (rval > 0) {
251+
vep->link_frequencies =
252+
kmalloc_array(rval, sizeof(*vep->link_frequencies),
253+
GFP_KERNEL);
254+
if (!vep->link_frequencies) {
255+
rval = -ENOMEM;
256+
goto out_err;
257+
}
259258

260-
vep->nr_of_link_frequencies = rval;
259+
vep->nr_of_link_frequencies = rval;
261260

262-
rval = fwnode_property_read_u64_array(fwnode, "link-frequencies",
263-
vep->link_frequencies,
264-
vep->nr_of_link_frequencies);
265-
if (rval < 0)
266-
goto out_err;
261+
rval = fwnode_property_read_u64_array(
262+
fwnode, "link-frequencies", vep->link_frequencies,
263+
vep->nr_of_link_frequencies);
264+
if (rval < 0)
265+
goto out_err;
266+
}
267267

268268
return vep;
269269

0 commit comments

Comments
 (0)