mirror of
https://github.com/torvalds/linux.git
synced 2026-03-08 01:04:41 +01:00
media: v4l2-fwnode: Allow passing NULL fwnode to endpoint parsers
v4l2_fwnode_endpoint_parse() and v4l2_fwnode_endpoint_alloc_parse() take a fwnode as the first argument and leave it up to the caller to check a valid fwnode has been obtained through various means. Instead, add a check here so the callers won't need to do that anymore. Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Reviewed-by: Michael Riesch <michael.riesch@collabora.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
This commit is contained in:
parent
e3d5436c70
commit
37a5b80a94
2 changed files with 7 additions and 4 deletions
|
|
@ -465,6 +465,9 @@ static int __v4l2_fwnode_endpoint_parse(struct fwnode_handle *fwnode,
|
|||
enum v4l2_mbus_type mbus_type;
|
||||
int rval;
|
||||
|
||||
if (!fwnode)
|
||||
return -EINVAL;
|
||||
|
||||
pr_debug("===== begin parsing endpoint %pfw\n", fwnode);
|
||||
|
||||
fwnode_property_read_u32(fwnode, "bus-type", &bus_type);
|
||||
|
|
|
|||
|
|
@ -182,7 +182,7 @@ enum v4l2_fwnode_bus_type {
|
|||
|
||||
/**
|
||||
* v4l2_fwnode_endpoint_parse() - parse all fwnode node properties
|
||||
* @fwnode: pointer to the endpoint's fwnode handle
|
||||
* @fwnode: pointer to the endpoint's fwnode handle (may be NULL)
|
||||
* @vep: pointer to the V4L2 fwnode data structure
|
||||
*
|
||||
* This function parses the V4L2 fwnode endpoint specific parameters from the
|
||||
|
|
@ -218,7 +218,7 @@ enum v4l2_fwnode_bus_type {
|
|||
*
|
||||
* Return: %0 on success or a negative error code on failure:
|
||||
* %-ENOMEM on memory allocation failure
|
||||
* %-EINVAL on parsing failure
|
||||
* %-EINVAL on parsing failure, including @fwnode == NULL
|
||||
* %-ENXIO on mismatching bus types
|
||||
*/
|
||||
int v4l2_fwnode_endpoint_parse(struct fwnode_handle *fwnode,
|
||||
|
|
@ -236,7 +236,7 @@ void v4l2_fwnode_endpoint_free(struct v4l2_fwnode_endpoint *vep);
|
|||
|
||||
/**
|
||||
* v4l2_fwnode_endpoint_alloc_parse() - parse all fwnode node properties
|
||||
* @fwnode: pointer to the endpoint's fwnode handle
|
||||
* @fwnode: pointer to the endpoint's fwnode handle (may be NULL)
|
||||
* @vep: pointer to the V4L2 fwnode data structure
|
||||
*
|
||||
* This function parses the V4L2 fwnode endpoint specific parameters from the
|
||||
|
|
@ -276,7 +276,7 @@ void v4l2_fwnode_endpoint_free(struct v4l2_fwnode_endpoint *vep);
|
|||
*
|
||||
* Return: %0 on success or a negative error code on failure:
|
||||
* %-ENOMEM on memory allocation failure
|
||||
* %-EINVAL on parsing failure
|
||||
* %-EINVAL on parsing failure, including @fwnode == NULL
|
||||
* %-ENXIO on mismatching bus types
|
||||
*/
|
||||
int v4l2_fwnode_endpoint_alloc_parse(struct fwnode_handle *fwnode,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue