Commit 04b96d1a authored by Laurent Pinchart's avatar Laurent Pinchart Committed by Mauro Carvalho Chehab

[media] v4l: omap3isp: Fix OF node double put when parsing OF graph

When parsing the graph the driver loops over all endpoints using
of_graph_get_next_endpoint(). The function handles reference counting of
the passed and returned nodes, so the returned node's reference count
must not be decreased manually in the normal path.

Move the offending of_node_put() call to the error path that requires
manual reference count handling.
Reported-by: default avatarH. Nikolaus Schaller <hns@goldelico.com>
Signed-off-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent 03c47aae
...@@ -2117,23 +2117,18 @@ static int isp_of_parse_nodes(struct device *dev, ...@@ -2117,23 +2117,18 @@ static int isp_of_parse_nodes(struct device *dev,
struct isp_async_subdev *isd; struct isp_async_subdev *isd;
isd = devm_kzalloc(dev, sizeof(*isd), GFP_KERNEL); isd = devm_kzalloc(dev, sizeof(*isd), GFP_KERNEL);
if (!isd) { if (!isd)
of_node_put(node); goto error;
return -ENOMEM;
}
notifier->subdevs[notifier->num_subdevs] = &isd->asd; notifier->subdevs[notifier->num_subdevs] = &isd->asd;
if (isp_of_parse_node(dev, node, isd)) { if (isp_of_parse_node(dev, node, isd))
of_node_put(node); goto error;
return -EINVAL;
}
isd->asd.match.of.node = of_graph_get_remote_port_parent(node); isd->asd.match.of.node = of_graph_get_remote_port_parent(node);
of_node_put(node);
if (!isd->asd.match.of.node) { if (!isd->asd.match.of.node) {
dev_warn(dev, "bad remote port parent\n"); dev_warn(dev, "bad remote port parent\n");
return -EINVAL; goto error;
} }
isd->asd.match_type = V4L2_ASYNC_MATCH_OF; isd->asd.match_type = V4L2_ASYNC_MATCH_OF;
...@@ -2141,6 +2136,10 @@ static int isp_of_parse_nodes(struct device *dev, ...@@ -2141,6 +2136,10 @@ static int isp_of_parse_nodes(struct device *dev,
} }
return notifier->num_subdevs; return notifier->num_subdevs;
error:
of_node_put(node);
return -EINVAL;
} }
static int isp_subdev_notifier_bound(struct v4l2_async_notifier *async, static int isp_subdev_notifier_bound(struct v4l2_async_notifier *async,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment