Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9a5b4b76 authored by Sakari Ailus's avatar Sakari Ailus Committed by Mauro Carvalho Chehab
Browse files

media: v4l: fwnode: Only zero the struct if bus type is set to V4L2_MBUS_UNKNOWN



In order to prepare for allowing drivers to set the defaults for a given
bus, make zeroing the struct conditional based on detecting the bus.
All callers now set the bus type to zero which allows only zeroing the
remaining bus union.

Signed-off-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
Tested-by: default avatarSteve Longerbeam <steve_longerbeam@mentor.com>
Tested-by: default avatarJacopo Mondi <jacopo+renesas@jmondi.org>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
parent 60359a28
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -301,6 +301,12 @@ static int __v4l2_fwnode_endpoint_parse(struct fwnode_handle *fwnode,
	u32 bus_type = 0;
	int rval;

	if (vep->bus_type == V4L2_MBUS_UNKNOWN) {
		/* Zero fields from bus union to until the end */
		memset(&vep->bus, 0,
		       sizeof(*vep) - offsetof(typeof(*vep), bus));
	}

	pr_debug("===== begin V4L2 endpoint properties\n");

	/*
@@ -309,10 +315,6 @@ static int __v4l2_fwnode_endpoint_parse(struct fwnode_handle *fwnode,
	 */
	memset(&vep->base, 0, sizeof(vep->base));

	/* Zero fields from bus_type to until the end */
	memset(&vep->bus_type, 0, sizeof(*vep) -
	       offsetof(typeof(*vep), bus_type));

	fwnode_property_read_u32(fwnode, "bus-type", &bus_type);

	switch (bus_type) {