diff mbox series

[2/5] v4l2-fwnode: v4l2_fwnode_endpoint_parse caller must init vep argument

Message ID 20200930144811.16612-3-sakari.ailus@linux.intel.com
State Accepted
Commit b3cc73d2bf14e7c6e0376fa9433e708349e9ddfc
Headers show
Series [1/5] adv748x: Zero entire struct v4l2_fwnode_endpoint | expand

Commit Message

Sakari Ailus Sept. 30, 2020, 2:48 p.m. UTC
Document that the caller of v4l2_fwnode_endpoint_parse() must init the
fields of struct v4l2_fwnode_endpoint (vep argument) fields.

It used to be that the fields were zeroed by v4l2_fwnode_endpoint_parse
when bus type was set to V4L2_MBUS_UNKNOWN but with commit bb4bba9232fc
that no longer makes sense.

Fixes: bb4bba9232fc ("media: v4l2-fwnode: Make bus configuration a struct")
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
---
 include/media/v4l2-fwnode.h | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Niklas Söderlund Oct. 2, 2020, 3:53 p.m. UTC | #1
Hi Sakari,

Thanks for your work.

On 2020-09-30 17:48:08 +0300, Sakari Ailus wrote:
> Document that the caller of v4l2_fwnode_endpoint_parse() must init the
> fields of struct v4l2_fwnode_endpoint (vep argument) fields.
> 
> It used to be that the fields were zeroed by v4l2_fwnode_endpoint_parse
> when bus type was set to V4L2_MBUS_UNKNOWN but with commit bb4bba9232fc
> that no longer makes sense.
> 
> Fixes: bb4bba9232fc ("media: v4l2-fwnode: Make bus configuration a struct")
> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>

Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>

> ---
>  include/media/v4l2-fwnode.h | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/include/media/v4l2-fwnode.h b/include/media/v4l2-fwnode.h
> index c09074276543..0f9a768b1a8d 100644
> --- a/include/media/v4l2-fwnode.h
> +++ b/include/media/v4l2-fwnode.h
> @@ -231,6 +231,8 @@ struct v4l2_fwnode_connector {
>   * guessing @vep.bus_type between CSI-2 D-PHY, parallel and BT.656 busses is
>   * supported. NEVER RELY ON GUESSING @vep.bus_type IN NEW DRIVERS!
>   *
> + * The caller is required to initialise all fields of @vep.
> + *
>   * The function does not change the V4L2 fwnode endpoint state if it fails.
>   *
>   * NOTE: This function does not parse properties the size of which is variable
> @@ -273,6 +275,8 @@ void v4l2_fwnode_endpoint_free(struct v4l2_fwnode_endpoint *vep);
>   * guessing @vep.bus_type between CSI-2 D-PHY, parallel and BT.656 busses is
>   * supported. NEVER RELY ON GUESSING @vep.bus_type IN NEW DRIVERS!
>   *
> + * The caller is required to initialise all fields of @vep.
> + *
>   * The function does not change the V4L2 fwnode endpoint state if it fails.
>   *
>   * v4l2_fwnode_endpoint_alloc_parse() has two important differences to
> -- 
> 2.27.0
> 
>
Sakari Ailus Oct. 2, 2020, 9:01 p.m. UTC | #2
On Fri, Oct 02, 2020 at 05:53:41PM +0200, Niklas Söderlund wrote:
> Hi Sakari,
> 
> Thanks for your work.
> 
> On 2020-09-30 17:48:08 +0300, Sakari Ailus wrote:
> > Document that the caller of v4l2_fwnode_endpoint_parse() must init the
> > fields of struct v4l2_fwnode_endpoint (vep argument) fields.
> > 
> > It used to be that the fields were zeroed by v4l2_fwnode_endpoint_parse
> > when bus type was set to V4L2_MBUS_UNKNOWN but with commit bb4bba9232fc
> > that no longer makes sense.
> > 
> > Fixes: bb4bba9232fc ("media: v4l2-fwnode: Make bus configuration a struct")
> > Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
> 
> Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>

Thanks for the review!
Laurent Pinchart Oct. 4, 2020, 8:35 a.m. UTC | #3
Hi Sakari,

Thank you for the patch.

On Wed, Sep 30, 2020 at 05:48:08PM +0300, Sakari Ailus wrote:
> Document that the caller of v4l2_fwnode_endpoint_parse() must init the

> fields of struct v4l2_fwnode_endpoint (vep argument) fields.

> 

> It used to be that the fields were zeroed by v4l2_fwnode_endpoint_parse

> when bus type was set to V4L2_MBUS_UNKNOWN but with commit bb4bba9232fc

> that no longer makes sense.

> 

> Fixes: bb4bba9232fc ("media: v4l2-fwnode: Make bus configuration a struct")

> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>

> ---

>  include/media/v4l2-fwnode.h | 4 ++++

>  1 file changed, 4 insertions(+)

> 

> diff --git a/include/media/v4l2-fwnode.h b/include/media/v4l2-fwnode.h

> index c09074276543..0f9a768b1a8d 100644

> --- a/include/media/v4l2-fwnode.h

> +++ b/include/media/v4l2-fwnode.h

> @@ -231,6 +231,8 @@ struct v4l2_fwnode_connector {

>   * guessing @vep.bus_type between CSI-2 D-PHY, parallel and BT.656 busses is

>   * supported. NEVER RELY ON GUESSING @vep.bus_type IN NEW DRIVERS!

>   *

> + * The caller is required to initialise all fields of @vep.


Would it make sense to explicitly state that fields should be zeroed if
no specific value is desired ? Maybe

 * The caller is required to initialise all fields of @vep, either with
 * explicitly values, or by zeroing them.

Apart from that,

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>


> + *

>   * The function does not change the V4L2 fwnode endpoint state if it fails.

>   *

>   * NOTE: This function does not parse properties the size of which is variable

> @@ -273,6 +275,8 @@ void v4l2_fwnode_endpoint_free(struct v4l2_fwnode_endpoint *vep);

>   * guessing @vep.bus_type between CSI-2 D-PHY, parallel and BT.656 busses is

>   * supported. NEVER RELY ON GUESSING @vep.bus_type IN NEW DRIVERS!

>   *

> + * The caller is required to initialise all fields of @vep.

> + *

>   * The function does not change the V4L2 fwnode endpoint state if it fails.

>   *

>   * v4l2_fwnode_endpoint_alloc_parse() has two important differences to


-- 
Regards,

Laurent Pinchart
diff mbox series

Patch

diff --git a/include/media/v4l2-fwnode.h b/include/media/v4l2-fwnode.h
index c09074276543..0f9a768b1a8d 100644
--- a/include/media/v4l2-fwnode.h
+++ b/include/media/v4l2-fwnode.h
@@ -231,6 +231,8 @@  struct v4l2_fwnode_connector {
  * guessing @vep.bus_type between CSI-2 D-PHY, parallel and BT.656 busses is
  * supported. NEVER RELY ON GUESSING @vep.bus_type IN NEW DRIVERS!
  *
+ * The caller is required to initialise all fields of @vep.
+ *
  * The function does not change the V4L2 fwnode endpoint state if it fails.
  *
  * NOTE: This function does not parse properties the size of which is variable
@@ -273,6 +275,8 @@  void v4l2_fwnode_endpoint_free(struct v4l2_fwnode_endpoint *vep);
  * guessing @vep.bus_type between CSI-2 D-PHY, parallel and BT.656 busses is
  * supported. NEVER RELY ON GUESSING @vep.bus_type IN NEW DRIVERS!
  *
+ * The caller is required to initialise all fields of @vep.
+ *
  * The function does not change the V4L2 fwnode endpoint state if it fails.
  *
  * v4l2_fwnode_endpoint_alloc_parse() has two important differences to