[PATCH 1/2] v4l: fwnode: Fix lane-polarities property parsing

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



fwnode_property_read_u32_array() only returns the number of array elements
if the array argument is NULL. The assumption that it always did so lead to
lane-polarities properties never being read.

Fixes: 4ee236219f6d ("media: v4l2-fwnode: suppress a warning at OF parsing logic")
Signed-off-by: Sakari Ailus <sakari.ailus@xxxxxxxxxxxxxxx>
---
 drivers/media/v4l2-core/v4l2-fwnode.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/media/v4l2-core/v4l2-fwnode.c b/drivers/media/v4l2-core/v4l2-fwnode.c
index d07c54efaa99..29e41312f04a 100644
--- a/drivers/media/v4l2-core/v4l2-fwnode.c
+++ b/drivers/media/v4l2-core/v4l2-fwnode.c
@@ -65,19 +65,23 @@ static int v4l2_fwnode_endpoint_parse_csi2_bus(struct fwnode_handle *fwnode,
 		}
 
 		rval = fwnode_property_read_u32_array(fwnode,
-						      "lane-polarities", array,
-						      1 + bus->num_data_lanes);
+						      "lane-polarities", NULL,
+						      0);
 		if (rval > 0) {
-			if (rval != 1 + bus->num_data_lanes /* clock + data */) {
+			if (rval != 1 + bus->num_data_lanes /* clock+data */) {
 				pr_warn("invalid number of lane-polarities entries (need %u, got %u)\n",
 					1 + bus->num_data_lanes, rval);
 				return -EINVAL;
 			}
 
+			fwnode_property_read_u32_array(fwnode,
+						       "lane-polarities", array,
+						       1 + bus->num_data_lanes);
 
 			for (i = 0; i < 1 + bus->num_data_lanes; i++)
 				bus->lane_polarities[i] = array[i];
 		}
+
 	}
 
 	if (!fwnode_property_read_u32(fwnode, "clock-lanes", &v)) {
-- 
2.11.0




[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux