]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/5.1.5/media-imx-clear-fwnode-link-struct-for-each-endpoint-iteration.patch
4.9-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 5.1.5 / media-imx-clear-fwnode-link-struct-for-each-endpoint-iteration.patch
1 From 107927fa597c99eaeee4f51865ca0956ec71b6a2 Mon Sep 17 00:00:00 2001
2 From: Steve Longerbeam <slongerbeam@gmail.com>
3 Date: Wed, 20 Feb 2019 18:53:30 -0500
4 Subject: media: imx: Clear fwnode link struct for each endpoint iteration
5
6 From: Steve Longerbeam <slongerbeam@gmail.com>
7
8 commit 107927fa597c99eaeee4f51865ca0956ec71b6a2 upstream.
9
10 In imx_media_create_csi_of_links(), the 'struct v4l2_fwnode_link' must
11 be cleared for each endpoint iteration, otherwise if the remote port
12 has no "reg" property, link.remote_port will not be reset to zero.
13 This was discovered on the i.MX53 SMD board, since the OV5642 connects
14 directly to ipu1_csi0 and has a single source port with no "reg"
15 property.
16
17 Fixes: 621b08eabcddb ("media: staging/imx: remove static media link arrays")
18
19 Signed-off-by: Steve Longerbeam <slongerbeam@gmail.com>
20 Cc: stable@vger.kernel.org
21 Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
22 Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
23 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
24
25 ---
26 drivers/staging/media/imx/imx-media-of.c | 15 +++++++++------
27 1 file changed, 9 insertions(+), 6 deletions(-)
28
29 --- a/drivers/staging/media/imx/imx-media-of.c
30 +++ b/drivers/staging/media/imx/imx-media-of.c
31 @@ -145,15 +145,18 @@ int imx_media_create_csi_of_links(struct
32 struct v4l2_subdev *csi)
33 {
34 struct device_node *csi_np = csi->dev->of_node;
35 - struct fwnode_handle *fwnode, *csi_ep;
36 - struct v4l2_fwnode_link link;
37 struct device_node *ep;
38 - int ret;
39 -
40 - link.local_node = of_fwnode_handle(csi_np);
41 - link.local_port = CSI_SINK_PAD;
42
43 for_each_child_of_node(csi_np, ep) {
44 + struct fwnode_handle *fwnode, *csi_ep;
45 + struct v4l2_fwnode_link link;
46 + int ret;
47 +
48 + memset(&link, 0, sizeof(link));
49 +
50 + link.local_node = of_fwnode_handle(csi_np);
51 + link.local_port = CSI_SINK_PAD;
52 +
53 csi_ep = of_fwnode_handle(ep);
54
55 fwnode = fwnode_graph_get_remote_endpoint(csi_ep);