Skip to content

Commit 107927f

Browse files
slongerbeammchehab
authored andcommitted
media: imx: Clear fwnode link struct for each endpoint iteration
In imx_media_create_csi_of_links(), the 'struct v4l2_fwnode_link' must be cleared for each endpoint iteration, otherwise if the remote port has no "reg" property, link.remote_port will not be reset to zero. This was discovered on the i.MX53 SMD board, since the OV5642 connects directly to ipu1_csi0 and has a single source port with no "reg" property. Fixes: 621b08e ("media: staging/imx: remove static media link arrays") Signed-off-by: Steve Longerbeam <[email protected]> Cc: [email protected] Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
1 parent 904371f commit 107927f

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

drivers/staging/media/imx/imx-media-of.c

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -145,15 +145,18 @@ int imx_media_create_csi_of_links(struct imx_media_dev *imxmd,
145145
struct v4l2_subdev *csi)
146146
{
147147
struct device_node *csi_np = csi->dev->of_node;
148-
struct fwnode_handle *fwnode, *csi_ep;
149-
struct v4l2_fwnode_link link;
150148
struct device_node *ep;
151-
int ret;
152-
153-
link.local_node = of_fwnode_handle(csi_np);
154-
link.local_port = CSI_SINK_PAD;
155149

156150
for_each_child_of_node(csi_np, ep) {
151+
struct fwnode_handle *fwnode, *csi_ep;
152+
struct v4l2_fwnode_link link;
153+
int ret;
154+
155+
memset(&link, 0, sizeof(link));
156+
157+
link.local_node = of_fwnode_handle(csi_np);
158+
link.local_port = CSI_SINK_PAD;
159+
157160
csi_ep = of_fwnode_handle(ep);
158161

159162
fwnode = fwnode_graph_get_remote_endpoint(csi_ep);

0 commit comments

Comments
 (0)